Remove Featured image meta box from WordPress Admin

In WordPress, remove_meta_box is used to remove a metabox from the post, page or any custom post type edit form in the admin section. When this article was first written, remove_meta_box didn’t work for the featured image box (postimagediv), so I had to dig the core functions for a workaround. WordPress has improved a lot since then, and today there is a much cleaner way.

I just wanted to remove the featured image box from the post edit form for the ‘contributor’ role (users who can’t publish posts). Here’s the code –

add_action( 'admin_init', 'w4dev_remove_post_thumb_support' );
function w4dev_remove_post_thumb_support() {
    if ( ! current_user_can( 'publish_posts' ) ) {
        remove_post_type_support( 'post', 'thumbnail' );
    }
}

How it works

WordPress only shows the featured image box when the current theme supports post-thumbnails and the post type supports thumbnail

if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) ) {
    add_meta_box( 'postimagediv', __( 'Featured image' ), 'post_thumbnail_meta_box', null, 'side', 'low' );
}

So by removing the thumbnail support from the post type when the logged in user can’t publish posts, the box never gets added. The nice thing about this approach is that it works for the block editor too – the Featured image panel disappears there as well, since the block editor checks the same post type support.

If you only use the classic editor and prefer to remove just the meta box, remove_meta_box does work for the featured image nowadays –

add_action( 'do_meta_boxes', 'w4dev_remove_post_thumb_meta_box' );
function w4dev_remove_post_thumb_meta_box() {
    if ( ! current_user_can( 'publish_posts' ) ) {
        remove_meta_box( 'postimagediv', 'post', 'side' );
    }
}

That’s it.