My default media setting in WordPress blog is 150x150, 300x300, 1024x1024 respectively for thumbnail, medium, large images. Now I am designing a theme that need different size thumbnail images to show in theme. For this, I go to the media setting again and changed the setting with my news sizes like 72x72, 250x250, 400x400 respectively for thumbnail, medium, large images.

But now to resize my old uploaded images, I used Regenerate Thumbnails WordPress plugin and that generated my new media setting images size easily. So this solved my main problem.

Main Question:

Now the main problem that just occurred is that my hosting space is now going to end. When I checked my files then found that I have 7 images of one image and from that I am only using 4.

---------- and so on ----------

Now I want to delete 150x150, 300x300, 1024x1024 sizes images. For this many recommend me DNUI (Delete not used images) and Clean Up Images WordPress plugins but they are not picking those old image sizes.

Q:) So How To Delete My Desired Image Sizes From wp-content/uploads folder?


4 Answers 4


A quick and easy fix for this is to make use of a plugin called Force Regenerate Thumbnails (to which I don't have any affiliation to)

Unlike a plugin like Regenerating Thumbnails, Force Regenerate Thumbnails creates all your new custom sizes and delete all redundant/orphaned sizes.

Force Regenerate Thumbnails allows you to delete all old images size and REALLY regenerate the thumbnails for your image attachments.

  • Glad it helped. I use this plugin a lot when experimenting with image sizes. :-) Commented Oct 23, 2014 at 16:09
  • What version of Wordpress are you running? I'm on 4.0.1 and it throws a ton of errors.
    – bikey77
    Commented Jan 25, 2015 at 8:09
  • I haven't tested it on 4.0+. You should contact the plugin author if there is abug in the plugin so that he/she can get to work on that. :-) Commented Jan 25, 2015 at 8:46

That's easy! If you have SSH access, log in and do the following for each size. I am just showing 150x150 size only.

Go to the desired uploads folder via command line.

cd /your-site.com/wp-content/uploads

Let's find if that size is available.

find ./uploads/*  -iname '*-150x150.*' -ls

If you see some images as the output then delete 'em with

find ./uploads/*  -iname '*-150x150.*' -exec rm {} \;

Do make sure you back up everything before running such a command.

Or you can search for all the resized images with this command

find . -regextype posix-extended -regex ".*-[[:digit:]]{2,4}x[[:digit:]]{2,4}(@2x)?.(jpg|jpeg|png|eps|gif)" -type f

If there are any. Then you can delete them all with the following command

find . -regextype posix-extended -regex ".*-[[:digit:]]{2,4}x[[:digit:]]{2,4}(@2x)?.(jpg|jpeg|png|eps|gif)" -type f -exec rm {}  \;

Again, make sure you back up everything before running such a command.

After all that, instead of generating all sizes again, you can use OTF Regenerate Thumbnails.

This plugin behaves similarly to Regenerate Thumbnails except that images are resized automatically / on the fly, when they are used. Once created, they won't be processed again.


  • 3
    This still leaves the old size data in the database
    – MrCarrot
    Commented Jun 6, 2020 at 10:59
  • This solution is the best for those who regenerated images using wp-cli then needed to remove old sizes from webp folder created previously by converter for media. Thanks a lot! Commented Mar 16 at 19:51

I found another solution using command line

shopt -s globstar 
rm  -- **/*{70x70.png,90x90.png,120x79.png,120x80.png,120x120.png,120x101.jpg,150x150.png,200x180.png,300x199.png,300x251.png}
rm  -- **/*{70x70.jpg,90x90.jpg,120x79.jpg,120x80.jpg,120x120.jpg,120x101.jpg,150x150.jpg,200x180.jpg,300x199.jpg,300x251.jpg}

where 300x251.jpg is your thumbnail file size .

if you want go extreemly do this rm -- **/*{*x*.png,*x*.jpg,*x*.jpeg,*x*.gif} this patter will delete all image have x at end of file name which I do not recommend .

  • 1
    This still leaves the old size data in the database
    – MrCarrot
    Commented Jun 6, 2020 at 10:59
  • 1
    I think Force Regenerate Thumbnails plugin can solve that 'not 100% sure about that' .
    – Salem F
    Commented Jun 8, 2020 at 20:05

Step 1: in file functions.php

add_filter( 'intermediate_image_sizes', 'remove_default_img_sizes', 10, 1);
function remove_default_img_sizes( $sizes ) {
  $targets = ['medium', 'medium_large','thumbnail','large', '1536x1536', '2048x2048','woocommerce_thumbnail','woocommerce_single','woocommerce_gallery_thumbnail','shop_catalog','shop_single','shop_thumbnail'];
  foreach($sizes as $size_index=>$size) {
    if(in_array($size, $targets)) {
  return $sizes;

Step 2: Setting wp-cli link: https://wp-cli.org enter image description here file wp.bat content =>

php "C:/wp-cli/wp-cli.phar" %*

file wp-cli.phar link: https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Step 3: Example at : use wp media regenerate --yes enter image description here

  • I can't tell: will that delete the old thumbnails?
    – Rup
    Commented Dec 12, 2021 at 22:22
  • Even so though this is going to take time to regenerate thumbnails that don't actually need regenerating.
    – Rup
    Commented Dec 12, 2021 at 22:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.