🚀 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, even after setting it there, it's not 100% guaranteed that thumbnails won't be generated automatically. If some hidden settings are not configured, the website will continue to generate thumbnails. This article explains how todisable thumbnail generation under 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 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.wordpress缩略图设置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 code
add_image_size
thumbnails_size
If 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 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);

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.Stop Generating Image SizesThis 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 Code

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

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

「Naibabiji WordPress Website Building Coaching」 — From selecting a domain and purchasing hosting to installing themes and publishing posts, I「ll guide you through every step, helping you avoid detours and reach your goals directly.

👉 Learn about 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 to Follow