How To Add Custom Image Sizes To WordPress Media Uploader

WordPress comes out with image_size_names_choose and add_image_size function, which allows us to add custom image sizes to WordPress’ media uploader. It saves a lot of size if you don’t want to choose one of the predefined image sizes.

WPMayor has a snippet which uses this function to add a custom 300x250px size to WordPress media uploader. Add following snippet to your current theme’s functions.php file:

if ( function_exists( 'add_image_size' ) ) {
	add_image_size( 'new-size', 300, 250, true ); //(cropped)
}

add_filter('image_size_names_choose', 'my_image_sizes');
function my_image_sizes($sizes) {
        $addsizes = array(
                "new-size" => __( "Custom Size")
                );
        $newsizes = array_merge($sizes, $addsizes);
        return $newsizes;
}

50% OFF on all plans at OceanWP. Use coupon code:

Close
Scroll to Top