Герб Укріїни
Believe in Ukraine and the Armed Forces. Glory to Ukraine!

How to disable extra image generation in WordPress and clean up the media folder?

1. Install the plugin https://wordpress.org/plugins/regenerate-thumbnails/

2. After installing the plugin, check which images are being generated here:

3. Check which images you don’t need to generate. And create a function from them (add it to the functions.php file of your theme).

4. Function code to disable image generation:

Читайте також:  How to display attributes on the product page in WooCommerce, under a short description

Where, for example, unset( $sizes[ ‘large’ ]); – replace ‘large’ with the name of your image sizes (taken from the plugin).

Once you’ve created this list and saved it in your theme’s file, the image sizes you’ve listed will no longer be generated. But the question arises – what about the existing images?

How to clean up your media folder from unnecessary generated images?

For example, if you have an online store with even a hundred products, and each product has several images, which are duplicated 10 times, your site size is already significant. What to do?

  1. Create a site backup.
    In our plugin, check the box – free up disk space by deleting old unregistered thumbnail sizes. This may cause image loading errors on post pages.
    Click – regenerate thumbnails for all 28 attachments.

Learn more about how to disable thumbnail generation:

Leave a Reply

Your email address will not be published. Required fields are marked *