Just as a test I tried to add the featured image meta box where I wanted without filtering the other one:
add_action('admin_init', 'customposttype_image_box');
function customposttype_image_box() {
add_meta_box('custompostimagediv', __('Custom Image'), 'post_thumbnail_meta_box', 'customposttype', 'normal', 'high');
}
That worked great, added exactly the meta box I wanted, right where I wanted it. However, I didn’t touch the default featured image box, so that one is still sitting there on the page.
I figured, if add_meta_box
added the box I want, remove_meta_box
should get rid of the other one right?
Wrong. I tried this and got nothing:
add_action('admin_init', 'customposttype_image_box');
function customposttype_image_box() {
remove_meta_box( 'postimagediv', 'customposttype', 'side' );
}
Now, if you look at the documentation for the remove_meta_box function, it appears that it only works for ‘post’, ‘page’, or ‘link’ pages, and only in the ‘normal’, or ‘advanced’ context.
I tried it in those circumstances, and it does work fine. But I also tried it on a custom post type and the ‘side’ context with no problem.
But I couldn’t get it to remove a featured image meta box on any page, post, or custom post type admin page.
It’s not just a matter of the context, I could remove other meta boxes from the side, like the Publish box:
add_action('admin_init', 'customposttype_image_box');
function customposttype_image_box() {
remove_meta_box( 'submitdiv', 'customposttype', 'side' );
}
But for some reason, I cannot remove the Featured Image meta box, it almost seems like a bug. It’s too bad, if I could remove that meta box it would totally solve my problem!