Prevent WordPress automatically creates unused image sizes

Hello,

Today i received the notice from my hosting provider regarding some image directories in my account is filling up with thousands of files, in excess of the number permitted on the hosting platform.

I have to go to each directory to delete the unused image sizes caused WordPress automatically created (screenshot attached).

e.g.
150x150
300x183
80x80
90x55

How to prevent the Wordpress creates these unused image sizes? I just want to keep the original size and the image which i created custom size when i created the post, that's enough.

Thanks,
Tuan.

  • Predrag Dubajic

    Hey @Khanh,

    Hope you're doing well today :slight_smile:

    This is most likely caused by your theme, most of the themes use WordPress image creation function that create custom image sizes when you upload your image.
    This way they can use different size images to load on different parts of the site, for example if theme needs to load 90x90 thumbnail image it will load image in that size instead of using full image thus saving the bandwidth and increasing page load.

    It would be best to contact your theme developer to see which images you are not using and is safe to remove from creating on upload.
    If you want to do it yourself you will need to search for add_image_size() functions through your theme files, but most probably you will find it in functions.php file.

    Hope this helps.

    Best regards,
    Predrag

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.