• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2662

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

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

  • Add Tags To Pages
  • Get Tags for Custom Post Type
  • Add Categories & Tags to AgentPress Listings Plugin
  • How To Add Post Tags To Pages

Custom Post Type Post Categories

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems