How to Disable Creation of Unnecessary Thumbnails in WordPress

WebTechRiser.com > WordPress > How to Disable Creation of Unnecessary Thumbnails in WordPress

When an image is uploaded to WordPress, WordPress creates 4 different sized images of that image in addition to the original image. These are,

  • Thumbnail
  • medium,
  • medium-large, and
  • large.

In addition to these sizes, third-party plugins can create thumbnails of their own size. For those who have a low-budget blog or office site where storage facilities are limited, multiple thumbnails of the site’s image can cause drug storage to run out.

Think about it, unnecessary additional images are eating up your server space and slowing down your site!

This tutorial discusses some simple ways to solve this problem.

Stop creating images of different sizes with the plugin

In my opinion, the easiest way to stop the creation of unnecessary images is to install the “Stop Generating Unnecessary Thumbnails” plugin developed by CodeExpert. Just install the plugin and choose which of the image sizes you want to prevent from generating.

This plugin can work seamlessly with any other WordPress plugin or theme, even with WooCommerce. The plugin is easy to install and most importantly, it’s free.

Stop creating unwanted image sizes through the website’s functions.php file

I put this method at number two on the list in terms of simplicity. This function will stop creating unnecessary size image thumbnails in your site’s functions.php file. Here, a filter function called intermediate_image_sizes_advanced of WordPress is used.

function add_image_insert_override($sizes) {
    unset( $sizes['thumbnail'] );
    unset( $sizes['medium'] );
    unset( $sizes['large'] );
    return $sizes;
}
add_filter( 'intermediate_image_sizes_advanced', 'textdomain_add_image_sizes_override' );

This function has stopped creating ‘thumbnail‘, ‘medium‘, and ‘large‘ images.

You can edit the functions.php file through the built-in “Theme File Editor” in the Appearance menu of your WordPress website.

The easiest way to stop creating unnecessary image thumbnails

This can be turned off by changing the default settings in the Media Settings in the WordPress Settings> Media menu. Change the Thumbnail size, Medium size, and Large size values ​​of the setting to “0” (Zero). Really! Absolutely easy, isn’t it!!

  1. First, log in to your WordPress website.
  2. Now click on Media from the Setting menu.
  3. You will see the Media Settings form as below. You will see 3 input fields for changing thumbnail size, Medium size, and Large size. If you want to stop creating all image thumbnails, set the value of all input fields to “0” (Zero).
  4. Now save your new values ​​in the database by clicking on the Save Changes button at the bottom of the form.
Media Settings page of WordPress
Media Settings page of WordPress

There is more work to be done. Themes that you are using, in addition to WordPress’s own sizes, themes or plugins can create their own sized image thumbnails as needed. These can be found by looking at the thumbnail files of different sizes of an image in your site’s “/wp-content/uploads/” folder.

Also, open the theme’s functions.php file and search for it by add_image_size, or, set_post_thumbnail_size. Finding these two words means that additional image thumbnails are being created. If you want to stop creating these additional images, you can delete these lines, or comment the lines out.

set_post_thumbnail_size (1200, 9999 );
add_image_size( 'homepage-thumb', 220, 180, true );

Using the two functions of WordPress in the two lines above, theme developers can create additional sized image thumbnails as needed.

Use Child Theme

A warning to users of third party WordPress themes. Instead of making these changes to the original theme, make these changes within the child theme.

Because, any new update to the original theme, in fact, you will lose these changes.

Category WordPress

Leave Your Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.