Remove Custom Taxonomy Metabox from Custom Post Type Screen

I have two hierarchical custom taxonomies, each on a corresponding custom post type. I would like to remove the metabox for each on the post type’s edit screen.

I have read remove custom taxonomy metabox form custom post type and How do you remove a Category-style (hierarchical) taxonomy metabox? but I’m still stuck.

The function I’m using is:

function remove_taxonomies_metaboxes() {
    remove_meta_box( 'partner_typediv', 'partners', 'normal' );
    remove_meta_box( 'person_typediv', 'people', 'normal' );
}
add_action( 'admin_menu' , 'remove_taxonomies_metaboxes' );

I unprefixed the post_types and custom_taxonomies, but that’s it. I’ve tried using the admin_menu hook and the add_meta_boxes hook recommended by the Codex. I’ve tried both normal and side for the third parameter.

The above function is located in an mu-plugins file below the function that registers the post types and taxonomies.


EDIT: It was a typo in the register_taxonomy function. I’m a horrible person. Thanks for everyone for the help. I still learned some stuff!

4

If you are manually registering your custom taxonomy via register_taxonomy then you can pass in arguments to control where the metabox appears.

In the example below setting show_ui to false would completely remove the metabox from the edit screen, the quick edit screen, and the admin menu. But if you set show_ui to true you can achieve more nuanced control by then using the show_in_quick_edit and meta_box_cb arguments (setting the later to false hides the metabox on the CPT edit screen as desired).

register_taxonomy( 'your_custom_taxonomy', array( 'your_custom_post_type' ), $args );
$args = array(
    'show_ui'                    => true,
    'show_in_quick_edit'         => false,
    'meta_box_cb'                => false,
);

Leave a Comment