How to Convert WordPress Categories to Custom Taxonomies

Do you want to convert your WordPress categories into custom taxonomies?

Categories are one of the two default taxonomies that help you sort your content. WordPress also allows you to create and use custom taxonomies.

In this article, we will show you how to easily convert WordPress categories to custom taxonomies.

Converting WordPress categories to custom taxonomies

Why and When Do You Need to Convert Categories into Custom Taxonomies?

A taxonomy allows you to organize groups of posts and custom post types on your WordPress website. By default, WordPress comes with two pre-made taxonomies: categories and tags.

However, you can also create custom taxonomies with WordPress, which can be used with existing or custom post types.

As your WordPress blog grows, you might need to convert your categories into a custom taxonomy because it can be overwhelming to file and keep track of each post in a category with different subcategories.

Using custom taxonomies for tagging allows for more accurate and detailed classifications and better content organization.

For example, if you have a recipe website, then creating categories for cuisine type, dietary restrictions, and meal type can be a bit confusing.

Preview of categories and subcategories

However, by creating a custom taxonomy for each of these topics, you can make content organization easier.

Custom taxonomies can also help improve your SEO rankings by giving you the flexibility to use more specific and targeted taxonomy terms.

Having said that, let’s take a look at how you can easily convert categories into custom taxonomies.

How to Convert WordPress Categories to Custom Taxonomies

First, you will need to install and activate the Taxonomy Switcher plugin. For more detailed instructions, you may want to see our step-by-step guide on how to install a WordPress plugin.

Upon activation, head over to the Tools » Taxonomy Switcher page from the WordPress admin sidebar to convert categories to custom taxonomies.

Once you are there, you need to select the ‘Categories’ option from the ‘Taxonomy to switch from’ dropdown menu.

This means that we will be converting a category into a custom taxonomy.

Choose categories option from the Taxonomy to switch from dropdown menu

Next, select the custom taxonomy that you want the categories to turn into from the ‘Taxonomy to switch to’ dropdown menu.

For example, if you have a category for dietary restrictions and you want to switch to a taxonomy of the same name, then you can select the ‘Dietary Restrictions’ option from the dropdown menu.

If you don’t know how to create a custom taxonomy, then you may want to see our tutorial on how to create a custom taxonomy in WordPress.

Choose your custom taxonomy from the dropdown menu

If you want to convert all the categories on your WordPress site into this specific custom taxonomy, then simply click the ‘Switch Taxonomies’ button.

However, if you just want to convert singular or multiple categories into this taxonomy, then you will need to add the IDs of those categories into the ‘Comma separated list of term ids to switch’ field.

Add category ID

To find a category id, you will need to visit the Posts » Categories page from the WordPress dashboard and hover your mouse over the category of your choice.

The category edit URL will now appear in a popup box at the bottom left corner of your screen.

From here, you can easily find your category ID, as it is the number that comes after ‘category&tag_ID=’ and before ‘&post_type’ in the URL.

For more instructions, see our tutorial on how to find category IDs in WordPress.

Attain category ID

Once you have found the IDs for categories, head back to the ‘Taxonomy Switcher’ page.

Next, simply add the IDs for all the categories that you want to convert into a specific taxonomy. Keep in mind that if you add more than one category ID, then you will have to separate them using commas.

Type category IDs in the field

Some of the categories in WordPress also have subcategories (child categories).

However, if you want to skip the child categories, then you can type the parent category next to the ‘Limit taxonomy switch for child terms of a specific parent’ option. This way, only the parent category will be switched to a taxonomy.

Finally, click the ‘Switch Taxonomy’ button to convert your WordPress category to a custom taxonomy.

Type parent category

You will now see the taxonomy that you have created along with the default taxonomies in the Posts menu tab in the WordPress sidebar.

Upon clicking on the custom taxonomy, you will be taken to a new page, where you can easily add terms for the taxonomy by typing in a name and slug.

Add a term to the dietary restrictions taxonomy

Once you have done that, just click the ‘Add New’ button at the bottom to create a new taxonomy term.

Now visit your WordPress block editor by opening up a new or existing post/page.

Here, you will notice that the category you switched to taxonomy is now displayed in the block panel on the right corner of the screen. From here, you can now easily add new terms or use existing ones for your WordPress blog post.

Custom taxonomy preview

How to Set Up Redirects From Category to Custom Taxonomy

After you turn one of your categories into a custom taxonomy, the category archive page will now show a 404 error. This is nothing to be worried about if your website is not live yet.

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

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

To do this, you will need to install and activate the All in One SEO for WordPress plugin. For more details, see our beginner’s guide on how to install a WordPress plugin.

All in One SEO

AIOSEO is the best WordPress SEO plugin on the market. It comes with a powerful redirection manager addon that makes it very easy to find broken links and fix them using 301 redirections.

Note: AIOSEO also has a free version. However, you will need the pro version for this tutorial to unlock the 301 redirection feature.

Upon activation, you will need to configure AIOSEO for your website. For more detailed instructions, please refer to our guide on how to set up All in One SEO correctly.

Once you have done that, head over to the All in One SEO » Redirects page from the WordPress admin sidebar.

Here, you will see a prompt asking you to activate the redirection manager. Go ahead and click the ‘Activate Redirects’ button.

Activate AIOSEO Redirects

The Redirects page will now be displayed on your screen.

From here, simply add /category/.* into the ‘Source URL’ field.

Once you do that, click the gear icon in the field to open some additional settings for the source URL. From here, check the ‘Regex’ option.

After that, enter your custom taxonomy slug, e.g. /dietary_restrictions/1 into the ‘Target URL’ field.

Add the source and target URL

Next, make sure that ‘301 Moved Permanently’ is chosen as the redirect option from the dropdown menu.

Finally, click the ‘Add Redirect’ button in the right corner.

Choose 301 as the redirect type

Upon creation, the redirect you created will be displayed at the bottom of the page.

From here, you can always toggle the switch to ‘Inactive’ if you want to disable it.

Disable the redirect by toggling the switch

This redirect will now send all your category archive traffic to your custom taxonomy.

However, we recommend using this method only if you don’t want to use categories at all.

If you want to redirect individual categories to a custom taxonomy page, then you may want to see our beginner’s guide on setting up redirects in WordPress.

We hope this article helped you learn how to convert WordPress categories to custom taxonomies. You may also want to see our guide on how to style individual categories differently in WordPress and our expert picks for the best conditional logic plugins for WordPress.

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

The post How to Convert WordPress Categories to Custom Taxonomies first appeared on WPBeginner.

12 Most Useful WordPress Custom Post Types Tutorials

Would you like to learn more about custom post types?

WordPress allows you to create custom types of content. Besides posts and pages, you might like to add other types of content to your website, such as products, reviews, or recipes.

In this article, we will share the 12 most useful WordPress custom post types tutorials.

12 Most Useful WordPress Custom Post Types Tutorials

What Are Custom Post Types in WordPress?

Custom post types are a type of content on your WordPress site that are not the default posts and pages. Custom post types are often added to a WordPress site using custom code or plugins.

For example, you can create custom post types for portfolios, testimonials, and products. Many WordPress plugins also use custom post types to store data on your website.

How can you use custom post types on your WordPress website?

As the largest free WordPress resource site for beginners, we’ve written a lot about custom post types over the years. Let’s take a look at the most useful custom post types tutorials here on WPBeginner.

1. Decide Whether You Need A Custom Post Type

Before you start creating custom post types or taxonomies on your WordPress site, it’s important to evaluate your needs. A lot of times you can get the same results with the default WordPress posts and pages.

With the help of built-in categories and tags, you can sort your content in many different ways. For example, with pages, you can set up a hierarchical layout of content with child pages. You can also set up subcategories.

Using the default WordPress features makes content management easier in many ways. For example, a custom post type wouldn’t appear on your blog page or in your post RSS feeds.

After looking at the default options, you may find that you don’t need custom post types after all.

If you are unsure, then refer to this guide about when you need a custom post type or taxonomy in WordPress.

2. Create Custom Post Types in WordPress

Once you decide that you do need a custom post type, you’ll need to create it. You can do this with a plugin, or manually by using code.

The Custom Post Type UI plugin makes it easy to create custom post types and is recommended for most users. You do this from the ‘Edit/Add Post Types’ page.

Create a New Custom Post Type With a Plugin

Alternatively, you can add a custom post type by pasting a code snippet into your theme’s functions.php file. The advantage of this method is your custom post types won’t disappear if the plugin is deactivated, but it’s only suitable if you’re comfortable handling code.

To learn more, see our guide on how to create custom post types in WordPress.

3. Create a Custom Post Types Archive Page

Adding custom post types in WordPress has become very easy thanks to the Custom Post Type UI plugin. However, many beginners have trouble displaying them on their websites.

To add a custom post type archive page, you first need to make sure that archives are enabled for your custom post type. In most cases they are, but if not then you can enable them in Custom Post Type UI’s advanced options or by using code.

CPT UI turn on archive

Now you can visit the custom post type archive page. Let’s say your custom post type is called ‘movies’ and you have SEO friendly permalinks enabled. Then your post type archive will be located at:

http://www.example.com/movies/

You’ll need to replace ‘example.com’ with your own domain name, and ‘movies’ with your custom post type name.

You can now add this archive page to your navigation menu. You can also customize it by adding a custom template to your WordPress theme or using a theme builder like SeedProd.

Edit your post type page

We show you how to do all of these things step by step in our guide on how to create a custom post types archive page in WordPress.

4. Add Custom Post Types to Your Main RSS Feed

By default, WordPress only includes your blog posts in your site’s main RSS feed. This means that your custom post type content won’t be visible to your main RSS feed subscribers.

You can easily include all publicly available post types into your main RSS feed by adding the following code to your theme’s functions.php file or a site-specific plugin.

function myfeed_request($qv) {
if (isset($qv['feed']))
$qv['post_type'] = get_post_types();
return $qv;
}
add_filter('request', 'myfeed_request');

However, you can use a different code snippet to only include specific custom post types.

For more detail on both methods, see our guide on how to add custom post types to your main WordPress RSS feed.

5. Make a Separate RSS Feed for Each Custom Post Type

WordPress automatically generates separate RSS feeds for different archive pages of your website, including custom post types.

Let’s say you have a custom post type called ‘movies’ on your website. We’ve already seen that you can view all content created in that post type by visiting the post type archive page.

https://example.com/movies

To view the RSS feed, all you need to do is add /feed/ to the custom post type archive URL.

https://example.com/movies/feed/

Alternately, you can also view the feed by adding the post type parameter to your main WordPress RSS feed. For example:

https://example.com/feed/?post_type=movies

Now that you know how to access the RSS feeds for any custom post type on your website, you can use that URL to create links to your custom post type feeds.

For instance, you may want to display an icon or plain text link on the custom post type archive page, so that your visitors can easily subscribe to those posts.

To learn how to do that, see our guide on how to make a separate RSS feed for each custom post type in WordPress.

6. Include Custom Post Types in Search Results

By default, WordPress will never show custom post types in its on-site search results. That means your visitors may miss out on some great content, and you’ll miss out on extra page views.

The easiest way to include custom post types in WordPress search is with the SearchWP plugin. It’s easy to use and lets you search content that isn’t included in the default WordPress search.

To include custom post types in your searches, simply click on the plugin’s ‘Sources & Settings’ button. Here you can put a checkmark next to each post type you wish to include in search results.

Including custom post types in WordPress search

You can also choose how important each custom post type is when displaying search results, and customize the search engine in other ways.

To learn how, see our step by step guide on how to include custom post types in WordPress search results.

7. Create a Search Form for Custom Post Types

You can also create a custom search form that will only show results from your custom post type. For example, if you have a custom post type called ‘movies’, then you can create a special movie search form that only returns movies in the search results.

This kind of custom search helps your visitors view more pages and spend more time on your website. This will give off positive WordPress SEO signals like lower bounce rate and increased dwell time.

You can create an advanced search form for custom post types using the SearchWP plugin. It allows you to create a second search engine that will only search your custom post type. You can then create a custom search form that you can add to your posts or sidebar.

For more details, see our guide on how to create an advanced search form in WordPress for custom post types.

8. Add Categories to a Custom Post Type

By default, WordPress categories can only be used to organize posts, not custom post types.

You could create a custom taxonomy to organize your custom posts, but what if you want to use the same categories you use for your blog posts?

The easiest way to associate your custom post type with categories is the Custom Post Type UI plugin. It adds a ’Taxonomies’ area in the settings for each custom post type.

Allowing Custom Post Types to Use Categories

Simply check the ‘Categories (WP Core)’ box and you will be able to use categories to organize your custom post types.

See our guide on how to add categories to a custom post type in WordPress to learn more.

9. Add Sticky Posts for Custom Post Types

The sticky posts feature in WordPress allows you to add featured posts. By default, it only works for blog posts and not for custom post types.

You can enable sticky posts for your custom post types as well by installing the Sticky Posts – Switch plugin. You simply check the box next to the custom post types that you wish to support this feature.

Visit the Settings » Sticky Posts - Switch Page to Configure the Plugin

Now when you visit the admin page for that custom post type, you will notice a new column where you can make posts sticky.

All you need to do is click the star next to the posts you wish to feature.

Click the Star Next to the Posts You Wish to Make Sticky

These sticky posts will be shown on your WordPress home page. To display sticky posts on your custom post type archive page as well, you’ll need to add some code to your theme files.

You’ll find all the details in our guide on how to add sticky posts in WordPress custom post type archives.

10. Add User Submitted Content to Custom Post Types

You may want to allow users to submit content for custom post types on your site, such as movie reviews or recipes. This is an easy way of adding extra content to your site.

One way to do this is by giving users access to your WordPress admin area and assigning them the author user role. Alternatively, you can add a submission form to your website.

You can do that using the WPForms plugin. You will need the Pro version to access the post submissions addon, and the provided ‘Blog Post Submission Form’ template makes creating the form simple.

By default, user submitted posts are saved as ‘Drafts’ pending review. You can change the post type in the form’s settings so content is submitted to a custom post type instead.

For more details, see our guide on how to allow users to submit posts to your WordPress site.

11. Switch or Convert Custom Post Types

You may come across situations where you will have to merge or convert custom post types. For example, you may want to move items from one post type to another.

Simply install and activate the Post Type Switcher plugin. Upon activation, you should go to the custom post type admin page and select the posts you want to move.

When you bulk edit the posts, you will notice there is a new drop down menu allowing you to change the post type for that item.

You can learn more in our guide on how to switch or convert custom post types in WordPress.

12. Add Custom Meta Boxes for Post Types

Custom meta boxes allow you to add custom fields to the WordPress post editor screen. This way you can create additional input fields for your post types.

The easiest way to create custom meta fields in WordPress is by using the Advanced Custom Fields plugin. Simply click the ‘Add New’ button on the Custom Fields page.

After that, you should follow the on-screen instructions to create a group of custom fields to add to your custom post type.

For further details, see our step by step guide on how to add custom meta boxes in WordPress posts and post types.

We hope this tutorial helped you learn some cool tricks for custom post types in WordPress. You may also want to see our ultimate WordPress security guide, or check out our list of tips on how to speed up WordPress performance.

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

The post 12 Most Useful WordPress Custom Post Types Tutorials first appeared on WPBeginner.