How to Disable Creation of Unnecessary Thumbnails in WordPress

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

In WordPress, when a user uploads an image, it creates four different predefined-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 may create thumbnails for their use. For those who own a low-budget blog or official site where storage facilities are limited, multiple thumbnails of each image can cause the storage to run out.

Just think about it! Unnecessary additional images are eating up your server storage and may slow 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 tell WordPress that it should not create 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 other WordPress plugins or themes, even with WooCommerce. The plugin is easy to install, and it is 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. Append the piece of code in your site’s functions.php file. This function will stop creating thumbnails that you do not want to generate.

Here, this function uses intermediate_image_sizes_advanced filter function of WordPress.

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 will stop creating “thumbnail“, “medium“, and “large” images.

Also read:  Speed up WordPress Website: Tips to Reduce Load Time

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

The easiest way to stop creating unnecessary image thumbnails

To turn off this feature, click on the Settings > Media menu of WordPress. Change the Thumbnail size, Medium size, and Large size values ​​of the setting to “0” (Zero).

It’s 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 presented below. You will see three 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 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. In addition to the thumbnails WordPress creates, other themes or plugins can create different-sized thumbnails for their use. You can find such images by looking at the thumbnail files 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. If you find these two words mean that WordPress is creating additional thumbnails. To stop creating these additional thumbnails, you can delete or comment out the lines of code.

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 thumbnails as needed.

Also read:  Debugging in WordPress: Useful plugin for Developers

Use Child Theme

Here is a warning to 3rd-party WordPress theme users. Instead of making these changes to the original theme, make these changes within the child theme.

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

Category WordPress

Leave Your Comment

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