How to get your custom image sizes into the WordPress media library select drop down for use when adding media into posts

When building a theme for use in WordPress quite often I use the add_image_size function to get WordPress to automatically create a size when a new image is uploaded through the media library. By default WordPress generates four image sizes named as ‘thumbnail’, ‘medium’, ‘large’ and ‘full’.

This is a great feature when my clients take the site over, as they don’t need to think about resizing an image beforehand as WordPress will do it automatically for them and to the dimensions I specify

But how do you get your new custom image size into the WordPress media library select so you can choose this size when writing a post?

The filter function below will do this for you. imagine that I have a custom image size defined in my functions.php as follows:

add_image_size( 'article_large', 750 );

In the custom function below, the variable $add_sizes takes an array of custom image sizes to add. This array is made up of your image size name as defined in add_image_size above and a friendly name for this size which will appear in the drop down select.

add_filter('image_size_names_choose', 'my_custom_image_sizes');
function my_custom_image_sizes($sizes) {

$add_sizes = array(
"article_large" => __( "Article Full Width")

$new_sizes = array_merge($sizes, $add_sizes);

return $new_sizes;