I'm currently working on reducing the site's categories and tags in an effort to reduce duplicate content and topical dilution. For that, I decided to merge a couple of categories into each other and remove others completely and use 301 redirects to point visitors to appropriate destinations on the blog.
Ghacks had for instance a Tutorial Basic and Tutorial Advanced category up until recently which divided tutorial posts, how-tos and the like, into those two categories. Sometimes, tutorials were assigned to both categories which did not make sense at all. I therefore made the decision to merge the Tutorials Advanced category into the Tutorials Basic category and rename that category in the end to Tutorials.
But how do you merge categories in WordPress? I did not really want to hack the database directly or change all posts assigned to the category that i want to merge manually. If you want to do it manually, simply edit any post in a category and replace the current category with the new one you want to assign it to. Merging cats manually gives you control over the process which is something that you should keep in mind, as we will get back to it later on.
What you need to do is the following. Open Post > All Posts and filter the posts by the category that you want to merge with another. This displays all posts of the blog that have been assigned to that category.If you have lots of posts in that category, you may need to change the amount of posts displayed on a single page. Do that with a click on Screen Options at the top to change the post count per page.
Do not go overboard here though as your server can only process that many changes at any given time. It may timeout or run into issues if you set the value to high. Select all posts on the page and click on Bulk Actions > Edit, and then apply to edit them all in bulk.
A menu is displayed right below the selection that you have just made at the top of the page. Locate the Categories menu here and pick the new category you want all of the posts to be listed in. Note that this will add the category to the post, but not remove the old category.
Click on Update to run the change. This may take quite some time depending on the number of posts you have selected and the speed of your server.
Once all posts have been assigned a new category in addition to the old, it is time to delete the old category in WordPress. click Posts > Categories and locate the category that you want to remove from WordPress. Move the mouse over it and select delete from the menu that opens up. Confirm the selection again and the category should be gone for good.
You then need to add a 301 redirect that points from the old category's url to the new category or another destination on your site. I recommend you use a plugin like Redirection for that, but you can alternatively add the redirect code to the .htaccess file as well.
You may encounter issues using the method if you have originally assigned multiple categories and want them all gone from the posts you have selected, but not deleted from WordPress. You can only do that by manually deleting excess categories from the post. I suggest you do that before you run the delete of the category.Advertisement
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.