Change size of featured image in Edit Post screen

How can I change the size of a featured image thumbnail on the Edit Post screen for one of my custom post types?

Please note that I am looking to modify the size of the image displayed in the admin ‘Edit Post’ screen, and not on the front end of my site.

The size is determined by WP itself at the moment, and I don’t seem to have any way of changing it.

4 Answers
4

From my past research I concluded that there is no sane way to affect the featured images box with actions and filters. My solution was to use jQuery inserted on the admin_head hook, to change things after they are loaded.

What I wanted was to add some textual detail outlining how the featured image would be used by the theme (something most themes should do just like sidebar descriptions, and for which there should be a filter). Here’s code that shows what I did:

function gv_admin_featured_image_tweaks() {
    $output = "STUFF TO INSERT HERE";
    ?>
<script type="text/javascript">
    jQuery(document).ready(function($) {
        $('#postimagediv .inside').append("<?php echo $output; ?>");
    });
</script>
    <?php
}
add_action('admin_head', 'gv_admin_featured_image_tweaks');

Not elegant but effective. You could do something similar to change the image. Instead of using .append() to add content at the end of the metabox you could instead get $(‘#set-post-thumbnail’) (the a tag with the image inside) and replace it with an img tag for the version of the featured image that you will use in your theme. Note that you can’t just replace the SRC value of the existing IMG tag because it also has width and height.

Leave a Comment