Use this snippet in your Worpdress theme’s functions.php file to remove a metabox from one or more custom post types or the default wordpress pages and posts. This is particularly useful for plugins that output a metabox on all post types.
Modify custom-post-type
to display the name of your custom post and metabox-name
to display the name of your metabox.
1 2 3 4 5 |
// Remove a Wordpress Metabox function digimix_remove_meta_box() { remove_meta_box( 'metabox-name', 'custom-post-type', 'normal' ); // change custom-post-type into the name of your custom post type } add_action( 'add_meta_boxes', 'digimix_remove_meta_box', 100000 ); |
///////////
To remove a single metabox from multiple posts (an array of posts):
1 2 3 4 5 6 7 8 9 10 |
function digimix_remove_metabox_from_array($postType) { $types = array('custom-post-type-1','custom-post-type-2','custom-post-type-3','custom-post-type-4'); if(in_array($postType, $types)){ remove_meta_box( 'metabox-name', $postType, 'normal' ); } } add_action( 'add_meta_boxes', 'digimix_remove_metabox_from_array', 100000 ); |
Reference: adapted from http://wordpress.stackexchange.com/a/91184/2015