Remove metabox from custom post editor

I’ve created a custom post type with a main metabox and two custom taxonomies in my functions.php. To create the taxonomies I used register_taxonomy().

In the custom post’s main metabox, I manage my taxonomies, i.e. I tick some checkboxes. So I don’t need the side-bar metaboxes anymore, I want to get rid of them, just as if I had their names unticked in the screen options.

Read More

Still, I want the taxonomies to appear in the left admin panel, associated to the custom post type I’ve created.

I tried remove_meta_box() but it has no effect. I tried to play with show_ui and show_in_menu : if the former is set to true and the latter to false, I have the metaboxes but the taxonomies disappear from my admin sidebar, so it is exactly the opposite of I want to do !

How can this be solved ? thanks

Related posts

2 comments

  1. I had a similar issue recently, and found that remove_meta_box() worked, but it had to be hooked by the admin_menu action.

    For example:

    add_action('admin_menu',  'cs49323_update_meta_boxes');
    
    function cs49323_update_meta_boxes() {
        remove_meta_box( 'tagsdiv-YOUR_CUSTOM_TAXONOMY', YOUR_CUSTOM_POST_TYPE, 'side' );
    }
    
  2. Solved, I misformed the target metabox to hide. The div tag must be contatenated to the name of the metabox, after it :

    function remove_my_meta() {
    remove_meta_box( 'mymetadiv','mycustompost','side' );
    }
    add_action('admin_menu','remove_my_meta');
    

    where mycustompost is the custom post type, and mymeta is the custom taxonomy.

Comments are closed.