X

Show Custom Image Sizes in Admin Media Uploader

Add this to functions.php to show additional sizes in the media uploader. You also need to add additional image sizes.

Code Snippet:

function show_image_sizes( $sizes ) {
    $new_sizes = array();
    $added_sizes = get_intermediate_image_sizes();
    
    // $added_sizes is an indexed array, therefore need to convert it
    // to associative array, using $value for $key and $value
    foreach( $added_sizes as $key => $value) {
        $new_sizes[$value] = $value;
    }
    
    // This preserves the labels in $sizes, and merges the two arrays
    $new_sizes = array_merge( $new_sizes, $sizes );
    
    return $new_sizes;
}
add_filter('image_size_names_choose', 'show_image_sizes', 11, 1);

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!