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?
Yes, you should use different name for your taxonomy. Like
noticeCategory
or something sincecategory
is already used/reserved by WordPress 😉