I want to remove all the metaboxes added by unrelated plugins to my custom post type, is this possible ?
I know I can use the function remove_meta_box(), but then I'll just remove the ones I currently have, but if any other plugin adds a metabox later on I'll have to manually remove it.
答案 0 :(得分:0)
Here is sample code to do that. In my case I have found my metabox id,priority and position.
Plugin have added this metabox 'my-meta-box-id'
to post type foo
.
Here is the code to remove metabox
add_action('add_meta_boxes', 'remove_plugins_meta_boxes');
function remove_plugins_meta_boxes(){
global $wp_meta_boxes;
unset($wp_meta_boxes['foo']['normal']['high']['my-meta-box-id']);
}
By this way you can remove your meta box.