Deleting certain tags from all pages

We have a fairly large website with multiple posts, and we would like to remove a certain tag (let’s just call it “tag A”) from all pages.

For a small amount of pages, we could just do this manually but if there are multiple tags to delete, or the page amount is large, it would become tedious easily.

Can anyone please guide me to do this simpler (for example, using a built-in Admin feature, or using an existing plugin), or if possible, point me to the right direction on how to make this plugin? (Doesn’t have to be in code, just general pointers!)

Thanks a lot in advance!

@orthocube, Using a plugin you could try something like:

  • Install devtools if not already: $ bin/gpm install devtools
  • Create new plugin: $ bin/plugin devtools newplugin
  • Create function handling event onPagesInitialized
    • Create a collection based on taxonomy (see example in docs)
    • Loop through pages found
      • Get taxonomy: $tax = $page->taxonomy(); (see Page class)
      • Remove the tag from the array
      • Set taxonomy: $page->taxonomy($tax);
      • Save page: $page->save();
1 Like

This is exactly the guide I’ve been looking for! I can write code, so it’s just the general guideline I needed.

Thank you very much!

It would be awesome if the plugin can be viewed from the Admin page and triggered using buttons and input textboxes, so I’ll try my best to find out how to do that.

Thanks again!