Show custom image sizes in the WordPress’ Add Media popup

Not entirely sure when this appeared in WordPress, I remember searching through the source code a while back to find a way to do this and it wasn’t available then.

Anyway, WordPress now has a image_size_names_choose filter that allow you to show your custom image sizes in the Add Media popup.

It is very handy if you’re building a website which requires additional sizes.

Here’s how it’s done (put that in your functions.php file or somewhere in your plugin)

add_action( 'after_setup_theme', 'my_setup_theme' );

function my_setup_theme() {

    // Create some new image sizes

    add_image_size( 'feature', 250, 250, true );

    add_image_size( 'portfolio', 450, 150, false );



function my_image_size_names($sizes)
    // Give them a name, and presto!

    $sizes['feature']= 'Feature Image';

    $sizes['portfolio']= 'Portfolio Image';

    // Don't forget to return the array of sizes.
    return $sizes;

Click on your Add Media icon above the editor and you should see the custom sizes for each uploaded image.

One comment on “Show custom image sizes in the WordPress’ Add Media popup

  1. Anh Tran

    It’s very strange that WordPress doesn’t do that automatically for us. I have the same problem and your solution is nice! Thanks for sharing.


Leave a Reply

Your email address will not be published. Required fields are marked *