First, I believe that “Categories” is actually for the custom taxonomy resource
and not the standard category
taxonomy. But in the menu, it’s labeled Categories
because you didn’t set a custom label for the resource
taxonomy (because the label
is commented out and defaults to Categories
):
register_taxonomy(
'resource', // the name of the taxonomy
'resources', // post type name
array(
'hierarchical' => true,
//'label' => 'Resources', // display name <- this
...
)
);
Secondly, the resource
taxonomy is actually assigned to the resources
post type, despite the taxonomy is not in the list of the post type’s taxonomies
property:
register_taxonomy(
'resource', // the name of the taxonomy
'resources', // post type name <- here, the taxonomy will be assigned to this post type
array( ... )
);
If you don’t actually want the resource
taxonomy to be assigned to the resources
post type, then either set the post type to null
or whatever the proper post type is:
register_taxonomy(
'resource', // the name of the taxonomy
null, // set to null, which means don't assign to `resources` or any post types..
array( ... )
);
Alternatively, you can use unregister_taxonomy_for_object_type()
to un-assign the taxonomy from a post type:
// Call after the post type and taxonomy are both registered.
unregister_taxonomy_for_object_type( 'resource', 'resources' );