0

Is it possible to give a custom post type its own category box?

If I use 'taxonomies' => array("category") or register_taxonomy_for_object_type('category', post_type); I get the desired box but it shows all categories across all post types.

enter image description here

I want the displayed values in the meta box to show just that post types categories.

If I use:

register_taxonomy( 'categories',
    array (
        0 => 'event',
    ),
    array( 
        'hierarchical' => false, 
        'label' => 'Event Categories',
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array('slug' => ''),
        'singular_label' => 'Event Category'
    ) 
); 

then I have to manually type tags opposed to being able to click a checkbox to assign categories.

enter image description here

This breaks the UX for less computer savvy people.

Is there a better way?

  • I answered based on a "must be" supposition. To improve your Question you should put all the code you are using, i.e.: "(... etc)" is not meaningful. – brasofilo Dec 5 '12 at 21:17
  • Added the full code for register_taxonomy for archival purposes. Added pictures to help further illustrate the actual question. – tr3online Dec 10 '12 at 21:01
1

Create a custom taxonomy (as you have) except change the hierarchical argument to true for the meta box to behave like the default categories taxonomy:

'hierarchical' => true
  • Ahh. Most excellent. Just what I was looking for! Thank you. – tr3online Dec 11 '12 at 9:17

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.