Family Encyclopedia >> Electronics

How to convert WordPress categories to custom taxonomies

Do you want to turn your WordPress categories into custom taxonomies? Categories are one of two default taxonomies that help you sort your content. However, WordPress also allows you to create and use custom taxonomies. In this article, we'll show you how to easily convert WordPress categories into custom taxonomies.

How to convert WordPress categories to custom taxonomies

Why and when do you need to convert categories to custom taxonomies?

Categories and tags are the two default taxonomies in WordPress. Taxonomies are used to classify and organize content into different topics.

In addition to the default taxonomies, WordPress also allows you to create custom taxonomies that you can use with existing post types or custom post types. For more information on this topic, check out our article on when you need a custom post type or taxonomy in WordPress.

As your website grows, you may need to convert your categories into a custom taxonomy. For example, let's say you have a category called topics with many subcategories. It would be time consuming to edit each post and file it under your new custom taxonomy.

Wouldn't it be nice if you could bulk convert some or all of your categories to the new custom taxonomy?

Let's see how you can easily convert categories to custom taxonomies without manually editing each post.

Convert WordPress categories to custom taxonomies

The first thing you need to do is install and activate the Taxonomy Switcher plugin. For more details, check out our step-by-step guide on how to install a WordPress plugin.

Upon activation, you need to visit Tools »Taxonomy Switcher page in the WordPress admin area to convert categories to custom taxonomies.

How to convert WordPress categories to custom taxonomies

On this page, you can select the taxonomies you want to convert. For this tutorial, we'll select 'Categories' as the taxonomy we want to change, and 'Topics' as the custom taxonomy we want to change to.

How to convert WordPress categories to custom taxonomies

If you want to convert all categories to a custom taxonomy, you can go ahead and click the 'Change Taxonomies' button.

The plugin will convert all categories to your selected custom taxonomy. You will see a success message like this:

How to convert WordPress categories to custom taxonomies

If you only want to convert specific categories, you'll need to add the IDs of those categories next to 'Comma separated list of term IDs to change' countryside. See our article on how to find category IDs in WordPress for more details.

How to convert WordPress categories to custom taxonomies

Also, if you want to skip child categories of a specific category, you can add the parent category IDs next to the 'Limit taxonomy change to child terms of a specific parent' option.

Don't forget to click the 'Change Taxonomy' button to save your changes.

Configuring category redirects to custom taxonomy

After changing the categories to a custom taxonomy, the category archive page will now display a 404 error page. This is nothing to worry about if your website is not live yet.

However, if your website is live, search engines may have already crawled your category pages and indexed them. This means that those pages may appear in search results and users coming from search engines will see a 404 error page.

To fix this issue, you need to redirect users to the new taxonomy page for each category.

Luckily, there is an easy solution for that.

First, you will need to install and activate the redirect plugin. For more details, check out our step-by-step guide on how to install a WordPress plugin.

Upon activation, you need to visit Tools »Redirection page. In the Source URL field, you must enter /category/.* and in the Target URL field, you need to enter your custom taxonomy bullet, eg. /subject/$1

How to convert WordPress categories to custom taxonomies

Next, you need to check the box next to the 'Regex' option and then click the 'Add Redirect' button.

This redirect will now send all traffic category file to your custom taxonomy. Only use this, if you don't want to use categories at all.

If you want to redirect individual categories to a custom taxonomy page, check out our beginner's guide on how to set up redirects in WordPress with detailed step-by-step instructions.

We hope this article has helped you learn how to turn WordPress categories into custom taxonomies. You may also want to see our guide on how to style individual categories differently in WordPress to customize your custom taxonomy templates.

If you enjoyed this article, please subscribe to our WordPress YouTube Channel video tutorials. You can also find us on Twitter and Facebook.