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 make webpages load faster, right? Is that really the case? You can open your website server's attachment folder and check for yourself. Below are two thumbnails automatically generated and cropped for me, captured by Naiba.
As shown in the image above, originally a 77KB original image, WordPress automatically cropped and generated 11 thumbnails of different sizes, and the largest image was actually 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 the post header image) were generated. In reality, the original image was only 4KB, but after generation, it skyrocketed to 60KB. Therefore, WordPress's automatic thumbnail cropping and generation feature is quite redundant. Apart from wasting space and traffic, it has no other practical significance. This is why Naiba chooses to disable WordPress automatic thumbnail generation.Disable WordPress Automatic Thumbnail Generation - Code Version
Step 1: In Settings > Media, set the dimensions for large, medium, and small thumbnails all 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 the 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 relevant 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 it.)

Naiba's 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 it.
A relatively safer method:In addition to the code above for manually deleting themes, you can also try the following code, which is also added to the theme functions. If you don't know how to modify theme 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);Disable WordPress Automatic Thumbnail Generation - Plugin Version
There is also another plugin that Naiba hasn't tested. If the above methods don't work or you want to directly use a plugin to disable thumbnail generation, you can try it.
This plugin claims to support any theme and plugin, 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 inserting them, you may also need toDisable WordPress Responsive Image CodeClean up already generated thumbnail files
Once set up, WordPress will no longer automatically generate thumbnails when you upload images later. However, previously generated thumbnails are still on your server. You can use the following method to batch delete the already generated thumbnail files. Other 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 links to media files when publishing posts in WordPress 5.3
- Summary of Methods to Automatically Add Watermarks When Uploading Images in WordPress

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.