Custom image sizes in WordPress

Let’s say I add an image with the resolution 10621 x 4000px.

WordPress will make four additional versions of the image with different sizes:


However the max size an image can be displayed in my web design is 755px width and unlimited height.

So that means there is no use having the largest image size 1024px. Rather we should change the max width to respect the width of the webdesign.

So that’s easy right? Just go to Settings -> Media -> and change the “Large Size” to 755px right? Unfortunately no…

A lot of themes have set a maximum image width in functions.php like this:

function yourthemename_content_width() {
    $GLOBALS['content_width'] = apply_filters( 'yourthemename_content_width', 640 );
add_action( 'after_setup_theme', 'yourthemename_content_width', 0 );

Which means that even if you change the Large Size in settings the largest thumbnail will never be larger than 640px.

So obviously you just need to disable the function above to let the settings in WP decide the image sizes. Or at lest change the resolution (640px) in the function to match the largest resolution an image is displayed at your site.

You can also add more custom sizes as explained eloquently here.