1

I created a custom post type named as 'notice'. For both categories I assigned taxonomy like -

function register_notice(){

    $args = array(
        'labels' => array(
                        'name' => 'Notice',
                        'singular_name' => 'Notice'
                        ),
        'query_var' => 'notice',
        'rewrite' => array(
                        'slug' => 'notice',
                    ),
        'public' => true,
        'supports' => array(
                            'title', 'author'
                            ),
        'taxonomies' => array('category') // here I created category taxonomy beside custom taxonomy
        );

    register_post_type('notice', $args);        

} // end of register notice category

add_action('init', 'register_notice');

then I created two categories under that taxonomy for notice custom post type. These two categories are 'class1' and 'class2'. The problem is, these two categories are also shown in the list of the default WordPress category list in the admin panel, and WordPress default categories are also shown in the list of my custom post type's category list. Is there any way to hide default categories from my custom post type's category list and to hide custom category list from the default WordPress category list?

1 Answer 1

1

Yes, you should use different name for your taxonomy. Like noticeCategory or something since category is already used/reserved by WordPress ;)

4
  • thanks for reply. but in that code block, if i change 'category' to 'noticeCategory' then noticeCategory is not showing in category list. because wordpress supports category and post_tag in that taxonomies. I can register my custom taxonomy for my notice custom post type, but i really want to keep that type of taxonomy by calling taxonomies inside the register_notice function. is there any way to do that? Oct 22, 2012 at 10:25
  • Yes, because you have to create custom taxonomies also. There is a generator for that ;)
    – Miha Rekar
    Oct 22, 2012 at 11:02
  • thanks again. may be i didnt make my problem understandable to you. I could make custom taxonomies for my custom post type. but i really want to assign 'category' taxonomy beside any custom taxonomy or tag. thanks for your reference though it doesnt solve my problem. Oct 22, 2012 at 11:25
  • Well you want to hide your categories from the WP default list and show only your own on your custom post type. Custom taxonomies (my suggestion) is how you achieve exactly that.
    – Miha Rekar
    Oct 22, 2012 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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