7

I'd like to be able to have categories of a custom post type, how do you set this up?

update

I want to keep the default categories for regular blog posts, but a separate set of categories just CPT.

migrated from superuser.com May 6 '11 at 15:30

This question came from our site for computer enthusiasts and power users.

  • 1
    Do you want to use the existing (default) categories, or define a set of categories specific to your CPT? – anu May 6 '11 at 15:36
  • possible duplicate of Is there a way to use regular categories with custom post types? – Chris_O May 6 '11 at 15:38
  • It's going to be a duplicate of something...the suspense is finding out what! – anu May 6 '11 at 15:39
  • I want to keep the default categories for regular blog posts, but a separate set of categories just CPT. – qodeninja May 6 '11 at 16:07
4

You need to add 'taxonomies' => array('category') in your register_post_type() function.

2

You have to register a taxonomy using register_taxonomy or register_taxonomy_for_object_type. The you can use wp_insert_term to insert values for that taxonomy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.