DEV Community


Posted on

How To Stop Generating Extra Image Thumbnails In WordPress

Did you notice that when you update an image in WordPress, it create different size thumbnails. Basically those thumbnails are required to show in your blog post or page based on different screen size.

For a small blog, these extra images may not be a problem, but when your website grows, you may feel that those extra images are eating your hosting space.

So in this article we will learn how stop generating those extra images.

Fortunately, Wordpress has an option to disable few of the images as shown in the picture.

You need to go to WordPress dashboard-> Settings-> Media and enter 0 to all those setting as shown.

Alt Text

This will stop generating three image sizes. If you want to stop generating other image sizes, you need to add this piece of code in your theme function.php file. It is preferable to use a child theme to do all these changes.

function shapeSpace_disable_image_sizes($sizes) {

unset($sizes['thumbnail']);    // disable thumbnail size
unset($sizes['medium']);       // disable medium size
unset($sizes['large']);        // disable large size
unset($sizes['medium_large']); // disable medium-large size
unset($sizes['1536x1536']);    // disable 2x medium-large size
unset($sizes['2048x2048']);    // disable 2x large size

return $sizes;
Enter fullscreen mode Exit fullscreen mode

add_action('intermediate_image_sizes_advanced', 'shapeSpace_disable_image_sizes');

If you want to learn more about these kind of tutorials please visit

RiansTech or

Discussion (0)