Why disable automatic thumbnail generation?
Why disable WordPress automatic thumbnail generation? The main reasons are to save server space and reduce webpage size. Most people might think that smaller, cropped images would take up less space and load faster, right? Is that really the case? You can check your website's server attachment folder yourself. Below are two thumbnails automatically cropped and generated, captured by Naiba.
As shown in the image above, a single 77KB original image was automatically cropped by WordPress to generate 11 thumbnails of different sizes, with the largest one being 263KB.
The image above shows that after setting the backend to generate medium and large thumbnails, only one 150-pixel thumbnail and one 768-pixel large image (used as a post header image) were generated. The original image was only 4KB, but after generation, it ballooned to 60KB. Therefore, WordPress's automatic thumbnail cropping feature is quite redundant. Apart from wasting space and bandwidth, it serves no practical purpose. This is why Naiba chooses to disable WordPress automatic thumbnail generation.Code Method to Disable WordPress Automatic Thumbnail Generation
Step 1: In Settings > Media, set the dimensions for large, medium, and small thumbnails to 0
Step 2: Enter WordPress God Mode (the all-settings options page) http://your-domain/wp-admin/options.php Search for medium_large_size_w and change it to 0. Step 3: Search your theme's functions.php file to see if there is any code specifically setting thumbnails (use the keyboard shortcut CTRL + F in the code box).
Search codeadd_image_size thumbnails_sizeIf related code is found after searching, comment it out. If not, leave it as is. (This step carries risks; be sure to back up the file. If something goes wrong, use FTP software to upload the backed-up functions.php file to overwrite the current one.)

Naiba Tip:How to back up and restore the functions.php file? UseFTP software, connect to your website server, then navigate to wp-content > themes > your-theme-folder > functions.php (download it). If an error occurs after modification, use FTP software to upload and overwrite the file.
A relatively safer method:Besides manually deleting the theme's code as above, you can also try the following code, which is also added to the theme's functions. If you don't know how to modify the theme's functions, you can useSafe Method to Add Code to the functions.php File: Code Snippetsfunction wcr_remove_intermediate_image_sizes($sizes, $metadata) {
$disabled_sizes = array(
'thumbnail', // 150x150 image
'medium', // max 300x300 image
'large' // max 1024x1024 image
);
// unset disabled sizes
foreach ($disabled_sizes as $size) {
if (!isset($sizes[$size])) {
continue;
}
unset($sizes[$size]);
}
return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'wcr_remove_intermediate_image_sizes', 10, 2);Plugin Method to Disable WordPress Automatic Thumbnail Generation
There is another plugin that Naiba hasn't tested. If the above methods don't work or you prefer to use a plugin to disable thumbnail generation, you can try this.
This plugin claims to support any theme and plugin, is compatible with WooCommerce, and takes effect after installation and configuration. Plugin download address:Stop Generating Image SizesFinally, if you find that images are not displayed on the frontend after insertion, you may also need toDisable WordPress Responsive Image CodeClean up already generated thumbnail files
Once the settings are configured, WordPress will no longer automatically generate thumbnails for images you upload later. However, previously generated thumbnails still remain on your server. You can use the following methods to batch delete the already generated thumbnail files. Related Articles:- Several Methods to Optimize WordPress Image Upload Speed and Reduce Database Queries
- WordPress Image Auto-Rename Plugin Unique Rename Image File Upload
- How to Set Image Link to Media File When Publishing a Post in WordPress 5.3
- Summary of Methods to Automatically Add Watermarks to WordPress Uploaded Images

Comments are closed
The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.