Once you create a custom post type, you can either:
- Add support for creating custom taxonomy types to your existing CPT code
- 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.
Was This Tutorial Helpful?