Resize Admin Featured Image Thumbnail in CPT Edit Screen

Righto, I found the answer in this trac ticket, so kudos to @SergeyBiryukov. I’m posting here for anyone else that wants to know 😉 However, I’ve not cracked custom size (e.g. 800px wide by 200px high for example) which would be nice.

// move the featured image box from the right hand column, to sit under the title section, and rename it 
add_action('do_meta_boxes', 'wpse33063_move_meta_box');

function wpse33063_move_meta_box(){
remove_meta_box( 'postimagediv', 'slider-image', 'side' );
add_meta_box('postimagediv', __('Add Your Slider Image'), 'post_thumbnail_meta_box', 'slider-image', 'normal', 'high');
}



// change size of admin featured image size in edit screen 
function change_featured_image_size_in_admin_28512( $downsize, $id, $size ) {
if ( ! is_admin() || ! get_current_screen() || 'edit' !== get_current_screen()->parent_base ) {
    return $downsize;
}

remove_filter( 'image_downsize', __FUNCTION__, 10, 3 );

// settings can be thumbnail, medium, large, full 
$image = image_downsize( $id, 'medium' ); 
add_filter( 'image_downsize', __FUNCTION__, 10, 3 );

return $image;
}
add_filter( 'image_downsize', 'change_featured_image_size_in_admin_28512', 10, 3 );

Leave a Comment