At some point ifolio.nl had 270 post tags. How did it get that way? Years of inconsistent tagging. “Design” and “design-work” and “branding” and “designing” — all live, scattered across posts.
That’s not just messy for visitors. WordPress loads part of that taxonomy on every page request, and redundant or duplicate tags contribute to unnecessary database queries. Time to clean up.
Working through 270 tags manually in the WordPress admin is no fun. I used Claude with a direct WordPress connection via MCP to do most of it in an automated way.
What MCP does here
MCP (Model Context Protocol) is the way Claude talks directly to external systems. Via a WordPress MCP plugin, Claude was able to:
- Retrieve all tags including term ID and post counts
- Determine which tag becomes the “master” for each cluster
- Assign the new master tag to all posts that had a tag being removed
- Do all of this without me clicking once inside WordPress admin
What you need
- A WordPress site with an MCP plugin installed (search “WordPress MCP” in the plugin directory — there are now several options)
- Claude with the corresponding MCP connector configured
- A claude.ai Pro or Max account for longer agentic sessions
Step-by-step approach
Step 1 — Retrieve all tags
Have Claude call wp_get_terms via MCP with taxonomy=post_tag and limit=200. With more than 200 tags, multiple calls are needed — use the search parameter with different letters to fetch them in batches.
The result: a list of all tags, their term IDs and how many posts they have.
Step 2 — Create clusters
Ask Claude to group the tags into logical clusters. For example: design, design-work, branding and designing belong together. Claude picks the best master tag (most posts, most descriptive) and marks the rest for merging.
Review these clusters yourself before proceeding. Some merges won’t make sense and you’ll want to correct them manually.
Step 3 — Run the merge
For each cluster, have Claude do the following:
- Fetch all posts that have a tag being removed — via
wp_get_postsfiltered by theterm_idof that tag - Add the master tag to each post via
wp_add_post_termswithappend=true - Move on to the next tag in the cluster
Always use append=true — this doesn’t replace all existing tags, it only adds the new one. Without that parameter you’ll wipe all other tags from a post.
Step 4 — Remove empty tags
Tags with 0 posts can then be deleted in bulk via WordPress admin: Posts → Tags → filter by count=0 → select all → delete. This is the only manual step, and it takes about a minute.
Step 5 — Check
Go through a few posts you merged and verify the tags are correct. The merge logic is simple enough that little can go wrong, but a spot check gives you confidence.
What I learned
Use term IDs, not slugs. Tags with special characters or similar names are more reliably identified by their numeric ID. State this explicitly in your prompt to Claude.
Work in batches of 20–30 tags per session. Trying to do everything at once uses too much context and Claude loses track with large tag sets.
Write one solid prompt and let it run. I wrote a fully self-contained instruction including all cluster information and term IDs, and let Claude work through it in one session. Result: 20 clusters handled without intervention.
Delete empty tags after the merge, not before. Otherwise you might accidentally remove tags that are still active as a master in another cluster.
Result
From 270 to 35 tags, in a session of about 45 minutes including putting together the clusters. The database has fewer redundant taxonomy queries when loading pages, and the tag pages are finally useful overviews rather than search fields full of duplicates.
A bonus: I now know exactly which tags I use and what for. That makes consistent tagging on new posts a lot easier.


0 Comments