WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to be entirely clear about this, what I'd like to do is change the size of the featured image thumbnail on the ADMIN panel, not on the front end.

I'm building a WP-admin theme, and I need to make the featured image larger on the back end.

It seems, featured images in the edit-post screen always spit out at 266x148px, ideally I'd like them to be actual size. I've searched around and can't find any hooks or functions that'd let me do this, but if anyone knows how, it's the people on here.

share|improve this question
Once this happened to me as a bug (images showing in actual size rather than resized in the Featured Image meta box). And it was not nice, they were blowing out of the window viewport. – brasofilo Jun 29 '13 at 3:03

You can filter 'admin_post_thumbnail_html' and replace the img element with a new one in the size you need.

Everything else will get messy and might lead to side effects.

  • Filtering image_downsize while watching for a size of 266×266 might affect images that are not meant to be shown in the metabox.
  • Changing the size for post-thumbnail temporary is not easy, because there are no safe points to start and end such a filter.
share|improve this answer
Are you saying it's better not to do it? – andy Jun 28 '13 at 23:43
No, I just listed two other ways and why I think they aren’t better. – toscho Jun 28 '13 at 23:52
Ah ok. But does filtering it allow me to have the size as auto? – andy Jun 29 '13 at 0:07
I can figure out how to change the html in the box, but not the image itself. add_filter( 'admin_post_thumbnail_html', 'add_featured_image_instruction'); function add_featured_image_instruction( $content ) { return $content .= '<p>This is the featured image</p>'; } – andy Jun 29 '13 at 0:16
I would also like to do this, here's my related question: wordpress.stackexchange.com/questions/160900/… – Sol Sep 16 '14 at 2:44

You could try this

 * step 1   define custom image size
 *          either plan to use 'full' (returns the size of the image you uploaded)
 *          OR define our custom image size so we can call one of those instead
 *          of the system defined default 'post-thumbnail'
 *          Remainder of this example assumes using 'full'
 *          no need to define custom a custom image size
 *          so remove the following add_image_size() line (and thereby skip step 1).
//add_image_size( 'admin-post-thumbnail', 846, 288, true );

 * step 2   replace the meta box with ours, for standard post type only
 *          set our own callback and move it into the larger main column
 *          Note the image, even in full size, won't ever have greater width than
 *          the current column width as CSS and modern admin panel make the image
 *          elements responsive to the column width.
 add_action('do_meta_boxes', 'wpse104670_move_meta_box');

function wpse104670_move_meta_box(){
    remove_meta_box( 'postimagediv', 'post', 'side' );
    add_meta_box('postimagediv', __('Featured Image'), 'wpse104670_post_thumbnail_meta_box', 'post', 'normal', 'low');

// step 3   custom callback to call our functional replacement for _wp_post_thumbnail_html for post type only
function wpse104670_post_thumbnail_meta_box( $post ) {
    $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
    echo wpse104670_wp_post_thumbnail_html( $thumbnail_id, $post->ID );

 * step 4   replace _wp_post_thumbnail_html with our version that calls 'full'
 *          (or e.g. 'admin-post-thumbnail' if custom)
 *          instead of the default 'post-thumbnail'
 *          We could do more here, like adjust the content width variable, but
 *          not entirely necessary as custom image size we defined will
 *          handle most of it and admin section has responsive CSS keeping image
 *          from ever exceeding column width.
function wpse104670_wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) {
    global $content_width, $_wp_additional_image_sizes;

    $post               = get_post( $post );
    $post_type_object   = get_post_type_object( $post->post_type );
    $set_thumbnail_link = '<p class="hide-if-no-js"><a title="%s" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
    $upload_iframe_src  = get_upload_iframe_src( 'image', $post->ID );

    $content = sprintf( $set_thumbnail_link,
        esc_attr( $post_type_object->labels->set_featured_image ),
        esc_url( $upload_iframe_src ),
        esc_html( $post_type_object->labels->set_featured_image )

    if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
        $old_content_width = $content_width;
        $content_width = 266;
        if ( !isset( $_wp_additional_image_sizes['full'] ) )    // use 'full' for system defined fullsize image OR use our custom image size instead of 'post-thumbnail'
            $thumbnail_html = wp_get_attachment_image( $thumbnail_id, array( $content_width, $content_width ) );
            $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'full' ); // use 'full' for system defined fullsize image OR use our custom image size instead of 'post-thumbnail'
        if ( !empty( $thumbnail_html ) ) {
            $ajax_nonce = wp_create_nonce( 'set_post_thumbnail-' . $post->ID );
            $content = sprintf( $set_thumbnail_link,
                esc_attr( $post_type_object->labels->set_featured_image ),
                esc_url( $upload_iframe_src ),
            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html( $post_type_object->labels->remove_featured_image ) . '</a></p>';
        $content_width = $old_content_width;

     * Filter the admin post thumbnail HTML markup to return.
     * @since 2.9.0
     * @param string $content Admin post thumbnail HTML markup.
     * @param int    $post_id Post ID.
    return apply_filters( 'admin_post_thumbnail_html', $content, $post->ID );
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.