🚀 Is building a website too difficult? Let me guide you step by step—Learn about the 「Naibabiji WordPress Website Building Coaching Service」 →

Disable WordPress 5.3 Automatic Thumbnail Cropping Feature

After installing WordPress, there are default settings for thumbnail generation (under Settings > Media). However, setting these does not guarantee 100% that thumbnails will not be automatically generated. If some hidden settings are not configured, the website will continue to generate thumbnails. This article explains how todisable thumbnail generation in WordPress 5.3

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 0wordpress缩略图设置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 code
add_image_size
thumbnails_size
If 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 Snippets
function 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.Stop Generating Image SizesThis 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 Code

Clean 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:

🚀 Still feeling confused after reading the tutorial? Let me guide you step-by-step.

「Naibabiji WordPress Website Building Coaching Service」—From choosing a domain and buying hosting, to installing a Theme and publishing content, I「ll coach you through every step, helping you avoid detours and reach your goal directly.

👉 Learn about the Website Building Coaching Service
🔒

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.

×
二维码

Scan QR Code to Follow

AI Website Building Assistant

🤖
Hello! I am the Naibabiji AI Assistant. How can I help you?
Quick Consultation: