Support
Web Development

How to Prevent WordPress from Generating Image Sizes

Have you ever noticed that whenever you upload an image to your WordPress website, the platform automatically generates multiple sizes of the same image?

In some cases (when using specific themes and/or plugins), the number of these images can reach up to forty-eight(!).

In the following guide we will explain why this happens, in which cases it can be helpful and how to completely disable this function.


Why does WordPress generate multiple sizes of the same image?

This function may sound strange and possibly cost-effective. However, it is obvious that the dimensions of an image used in a Slider are not the same as those of an image used as a thumbnail for an article.

For this reason the CMS has integrated a function to create three more images, in three different dimensions, trying to make it easier for the user, avoiding having to resize them manually.

Typically these dimensions are (Max Width Size x Max Height Size):
1) Thumbnail Dimensions : 150pixels x 150pixels
2) Medium Dimensions : 300pixels x 300pixels
3) Large Dimensions : 1024pixels x 1024pixels



How do I disable this function without using a plugin?

First solution: uploading the images via FTP Client

By using an FTP Client (e.g. FileZilla) to upload the images directly to the Server, we bypass the control panel and the WordPress admin interface, so the creation of the multidimensional images is not "triggered".

For detailed instructions on how to upload files to your site via FTP, click here: https://www.ip.gr/en/Web_hosting/how-can-i-upload-my-website-files-using-ftp-219.html



Second solution: WordPress setting and modification of the theme's functions.php file

First of all, after logging into the WordPress' admin interface, head over to the left sidebar, to the Settings section and then Media.

Media Settings for WordPress

On this particular page, there are the dimensions of the three dimensions that are being created. We set all the boxes to zero (0).

Zero Dimensions on images generated by WordPress
However, this change may not be sufficient if our theme uses a corresponding function that generates copies of the image. For this reason, we head through the File Manager to the functions.php file ( website's folder > wp_content > themes > active theme > functions.php ), and refer to where the specific functions are located (if they exist):

add_image_size(' ');
set_post_thumbnail_size(' ');

We either: 1) delete these lines of code, 2) comment them out (recommended), 3) or limit them to the absolutely necessary for the smooth operation of the site.

Warning

Due to the change above, it is possible that some elements of the theme used will be differentiated as there will no longer be the extra dimensions of the images. So it is possible that further configuration may be needed to avoid potential problems.



How do I delete the already-generated images?

As for the images that have already been created due to this function, they can be deleted via a plugin that will regenerate the existing thumbnails.

One of these is the Regenerate Thumbnails Plugin






IPGLOBAL IKE   |  IP.GR Web Hosting and Domain Name registration services in Greece
Cookies Preferences
 Functional  Statistics  Marketing


You can see detailed information about the use of cookies on the page: Terms of use