PHP Programmer and WordPress Ninja

How to stop WordPress from generating multiple image sizes

When you upload an image using the media uploader of your WordPress site, it creates multiple sizes of that image. By default, WordPress creates 4 additional sizes, but your theme and/or plugin(s) may create more sizes of that image. And it’s really a headache when you are considering your storage.

So, how to stop it?

There are 2 ways to stop WordPress from generating multiple image sizes-

1. With Coding: Set a filter to intermediate_image_sizes_advanced. It returns an array that contains the sizes. Make it return an empty array, and phew! You’re done.
Paste this into the functions.php file of your theme.

How to stop WordPress from generating multiple image sizes

PHP

1

2

3

4

5

add_filter('intermediate_image_sizes_advanced','mdc_image_sizes');

functionmdc_image_sizes($sizes){

returnarray();

}

It’ll stop WP to create additional image sizes and then you’ll have only one copy of the image.

2. Without Coding: Install this plugin- Stop Generating Image Sizes and you are done.
This plugin also allows you to choose which of the sizes you want to be prevented from creating.