Re-point posts from a duplicate tag to the canonical one

ContentIntermediate~15 min

Before you start

A connected site with content reads on and the add-post-terms write ability enabled. You supply the duplicate tag and the canonical one to keep.

Tags drift into near-duplicates fast: “ai” and “AI”, “how-to” and “howto”, a singular next to its plural. Each one spins up its own thin archive page, splits the posts that should sit together, and makes the tag list a mess to navigate. The first move in cleaning it up is making sure every post under the redundant tag also carries the one you are keeping.

This finds those posts, shows you the scope, and only adds the canonical tag once you approve. It is honest about where it stops.

The prompt
I have two tags that mean the same thing: [duplicate-tag] and the one I want to
keep, [canonical-tag]. I want every post to carry the canonical one.
First pass, read only: confirm both tags exist, and list every post that has
[duplicate-tag] so I can see the scope. Change nothing yet.
Once I approve, add [canonical-tag] to each of those posts, working in small
batches and showing me each batch before it saves, and list every post you
touched at the end. Be straight with me about the limits: this appends the
canonical tag, it does not strip the old one off the posts, and it cannot
delete the leftover tag. I will remove the old tag and delete the empty one
from the WordPress admin myself.

Why this is safe to run

The first pass is reads. Confirming both tags and listing every post under the duplicate writes nothing, so you approve the exact set before anything changes.

The write is a single, additive operation: it appends the canonical tag to each approved post. It does not replace a post’s tags, so nothing you already had gets dropped, and it never touches the post body or status. It stays inside its lane on purpose, and the recipe says so rather than overpromising: with only the add-post-terms write, it cannot strip the old tag off the posts, and there is no delete-term ability here, so it cannot delete the redundant tag either. Those two finishing steps are quick to do by hand in the WordPress admin once every post carries the canonical tag. The write ability stays off until you enable it, each call is checked against the capability of the user you bound the agent to, and every post it tags lands in the Activity Log so you can review the whole run.

Already connected? Skip the paste. Ask your agent for the “re-point posts from a duplicate tag” recipe, or just name the two tags, and it runs the same read-then-approve flow on your own site.

How it works

  1. Confirm both tags exist and read their current post counts.
  2. List every post that carries the duplicate tag so you see the full scope.
  3. Wait for your approval on that list.
  4. Add the canonical tag to each of those posts, in small batches, pausing on each.
  5. Return every post it changed so you can review it.

Questions

Does this delete the duplicate tag?
No. There is no delete-term ability here, so it cannot remove the leftover tag. It gives every affected post the canonical tag, and you delete the old, now-redundant tag yourself from the WordPress admin.
Does it remove the old tag from each post?
No. The add-post-terms ability appends, it does not replace, so both tags stay on a post until you strip the old one by hand. What it guarantees is that every post now also carries the canonical tag.