Add Custom Image Sizes to Media Popup

Add to your functions.php file to add new image sizes to the Upload/Insert dialog in WordPress.

You also need to add new image sizes.

Code Snippet:

if ( function_exists( 'add_image_size' ) ) {
    add_image_size( 'new-size', 300, 100, true ); //(cropped)
}
 
add_filter('image_size_names_choose', 'my_image_sizes');
function my_image_sizes($sizes) {
        $addsizes = array(
                "new-size" => __( "New Size")
                );
        $newsizes = array_merge($sizes, $addsizes);
        return $newsizes;
}

Posted in Admin area, Images