Yesterday, I started doing some long delayed clean up of categories here on 404 Tech Support. I felt like the categories had become too sprawling and too specific. Things could be improved by consolidating similar categories into one. Renaming the categories was the easy part. As I looked at the categories I wanted to merge, there were hundreds of posts in some of the old categories that would need to be updated to align with the end goal.
I dove into phpMyAdmin to run a few SQL queries to update the posts in the term_relationships tables. Unfortunately, as I thought that through, it wasn’t such an easy query. If categories were a 1-to-1 relationship, things would be easier. Unfortunately, categories and posts are many-to-many. If I wanted to get rid of category B, I would update all posts that were in category B to instead be in category A but what if there was a post that was already in category A? The situation was growing more complex, the more I thought about how to address my taxonomy mess in the wp_term_relationships table. Fortunately, a quick search of the WordPress plugins found just the tool to do the job: Term Management Tools. Continue reading...