What's WP
Our everything is about WordPress - best choice of WordPress users!
How to Add Categories Support to Custom Post Types in WordPress

How to Add Categories Support to Custom Post Types in WordPress

Categories are a built-in taxonomy in WordPress used to group content. They are utilized by almost every WordPress site, while the pity is that they are only available for posts by default. WordPress pages and custom post types do not support categories.

There are indeed cases that you want to categorize the contents in a custom post type, especially when too many contents have been added. So in below, we will introduce two easy ways to add categories support to custom post types in WordPress. Which way to choose depends on the real condition of your WordPress site.

Add Categories Support with Custom Post Type UI

This method is the suitable option if your custom post types are created with a popular plugin named Custom Post Type UI. As the plugin comes with an option for connecting a post type with any custom taxonomies or built-in taxonomies including categories, you can add the categories support easily by ticking a simple checkbox.

Assumed that you have installed the plugin and created custom post types with it, now you can go to the Add/Edit Post Types submenu under CPT UI in the WordPress dashboard, open the “Edit Post Types” tab, and then select the post type that you want to add categories support to.

Edit Post Types

On the settings page of the post type, scroll the screen down until you see a section for “Built-in Taxonomies”. In the content box, all the available taxonomies are listed one by one. Now, tick the checkbox before “Categories”, and then click “Save Post Type” to get the settings stored.

Add Categories Support to the Custom Post Type

After the changes are saved, you will see a “Categories” option appearing for the custom post type.

Categories

If you also want to add the support for other taxonomies like tags or a custom one, just do the same things as you have done with categories.

Add Categories Support to Custom Post Types Manually

The manual method is recommended if you are in one the following two situations.

  • You have added custom post types manually with the register_post_type function and inserted code in the functions.php file of your theme.
  • The plugin you use to create custom post types does not support categories.

In the former case, you only need to add the following line of code to your custom post type and locate it just after the custom options. This code will add the support for categories automatically.

Taxonomies

When checking through your code, you may find that the “taxonomies” line has already existed with another taxonomy defined. If this is true, you can add “category” next to the taxonomy and separate them with a comma.

Add Categories

In the latter case that you are using a plugin which defines the register_post_type function with no support for categories and does not allow you to make any modification, you can add the following code in the functions.php file.

Add Categories Support

Note that you have to replace “movies” with your own post type key which can be found in the URL of your custom post types.

Post Type Key

Author

Joyce is a professional writer & SEOer who loves trying new things and sharing the experience through blogging. She loves clean design, playing with different WordPress themes, SEO, etc. Now she is very struggle with purchasing a bubbling apartment in downtown. You can help her by clicking our ADs or making a purchase via our links ;-)

Close

Want to Learn More About WordPress?

Get Our Free Themes, Plugins, Support, SEO Tips, and Other Tutorials!

Email *