Recently one of our user asked us if it was possible to add categories to a custom post type they have created. Categories are one of the built-in taxonomies in WordPress. By default they appear only for posts. However, in some scenarios you may want to share them with a custom post type as well. In this article, we will show you how to add categories to a custom post type in WordPress. We will also show you how to display multiple post types on your category archive page.
The Plugin Method
For our beginner level users, we recommend using Custom Post Type UI plugin to create custom post types. When using Custom Post Type UI plugin, you have the option to associate your custom post type to any built-in or custom taxonomy including categories.
Upon installation, you need to visit CPT UI » Add/Edit Post Types to create a new custom post type or edit an existing custom post type you created with the plugin.
Scroll down on the Advanced Options to the bottom and there you will see the Built in Taxnomies option. Check the box next to categories and save your custom post type.
Don’t forget to click on the save post type button to store your settings.
Manually Adding Categories to a Custom Post Type
All you need to do is add this line in the arguments for your CPT.