1

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.

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

2 Answers 2

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' );
}
Sign up to request clarification or add additional context in comments.

1 Comment

This worked, thank you. It took a while to find the correct answer as the official docs are wrong, and lots of SO answers have the incorrect syntax.
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.