Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

1 Answer

up vote 1 down vote accepted

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
share|improve this answer
    
Ahh. Most excellent. Just what I was looking for! Thank you. –  tr3online Dec 11 '12 at 9:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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