I have custom taxonomies which up until 4.4 worked fine. Now when I go to /wp-admin/edit-tags.php?taxonomy=gmc_dietary&post_type=gmc_recipe
I get the message:
You are not allowed to manage these items
If I change show_ui
to true
then I can get to the page again but I don’t want the features that changing that brings.
register_taxonomy('gmc_region', 'gmc_recipe',
array(
'labels' => array(
'name' => __( 'Regions', 'gmc'),
'singular_name' => __( 'Region', 'gmc'),
'popular_items' => NULL,
'search_items' => __( 'Search Regions', 'gmc'),
'all_items' => __( 'All Regions', 'gmc'),
'edit_item' => __( 'Edit Region', 'gmc'),
'update_item' => __( 'Update Region', 'gmc'),
'add_new_item' => __( 'Add New Region', 'gmc'),
'new_item_name' => __( 'New Region Name', 'gmc'),
'menu_name' => __( 'Regions', 'gmc'),
),
'rewrite' => array(
'slug' => 'regions',
'with_front' => false
),
'show_in_nav_menus' => false,
'show_ui' => false,
'show_tagcloud' => false
)
);
What am I doing wrong?
First off, the link you provided is the wrong taxonomy, the below is correct:
/wp-admin/edit-tags.php?taxonomy=gmc_region&post_type=gmc_recipe
The parameter causing the issue is show_ui => false
which used to tell WordPress not to show the metabox for managing the category but now it turns the Taxonomny into a Private Taxonomy so it cannot be managed by the user ( using the User Inerface ).
If you want to remove the metabox or the admin menu you’ll have to do it manually:
Remove Metabox
/u/Toscho pointed out in chat if you want to not display the metabox you can pass false
to the meta_box_cb
parameter on register like so:
register_taxonomy('gmc_region', 'gmc_recipe', array(
'labels' => array( 'labels' => 'etc' ),
'meta_box_cb' => false,
'show_in_nav_menus' => false,
'show_ui' => true,
'show_tagcloud' => false
) );
OR you can remove them manually ( as you can with any metabox ) by doing the following:
function theme_hide_metaboxes() {
remove_meta_box( 'gmc_region_typediv', 'gmc_recipe', 'side' ); // Remove Region Taxonomy Metabox
}
add_action( 'do_meta_boxes', 'theme_hide_metaboxes' );
Remove Admin Menu
function hide_admin_menu_items() {
remove_submenu_page( 'edit.php?post_type=gmc_recipe', 'edit-tags.php?taxonomy=gmc_region&post_type=gmc_recipe' );
}
add_action( 'admin_menu', 'hide_admin_menu_items' );