Use Categories and Tags With Your Custom Post Type

Once you create a custom post type, you can either:

  1. Add support for creating custom taxonomy types to your existing CPT code
  2. Or add support for categories and tags just like your regular posts

There’s at least 2 ways to enable categories and tags for custom post types.

You can include this line of PHP code in the code you use to register a custom post type:

'taxonomies' => array('category', 'post_tag'),

Or you can add a new function like this:

add_action('init', 'add_category_tags_to_cpt');
 function add_category_tags_to_cpt() {
    register_taxonomy_for_object_type('category', 'your-cpt-name');
    register_taxonomy_for_object_type('post_tag', 'your-cpt-name');
}

Either method will add meta boxes on Edit screens for both Categories and Tags to all your single CPT’s.

Related Tutorials

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.