[ad_1]
I have a WordPress website where I had to delete all my products and start fresh. However, that left over 76,000 media images from those products that I now have to figure out how to delete. I can’t delete all the images, as a handful are still needed for the Theme. But basically every image after a certain date needs to be gone.
Trying to figure out an efficient way of doing that.
[ad_2]
You can bulk delete the files directly on the server, they’ll be located wp-content/uploads then in folders by year then month.
For example, all of the images uploaded in June 2024 would be in:
*/wp-content/uploads/2024/06*
Just pick a start date and delete the folders and files in one shot. This is the best and easiest way.
What kind of products are they? Are you using woocommerce or are these products just in the way of a regular page? You can try to first making a back-up of your database & media folder. The export the products you want to keep with the export tool in Admin > Tools > Export. Afterwards delete all media files using a plugin (since wp doesnt allow to delete that massive amounts of media files in one go). All that is left now is to import the products & media files.
If you are using a commerce plugin, its best to use their export tool. These export tool might also export the media files used by the product. Something that the native WP export tool doesnt do I think.
Out of all the plugins I tried for deleting images, this one proved to be the best of them all (yet, still not perfect, but close to it), and I would by all means take its pro version, it is much more powerful and not so expensive: [https://meowapps.com/media-cleaner/](https://meowapps.com/media-cleaner/)
PS don’t forget to backup your site as the 1st step – [https://www.fixrunner.com/best-wordpress-backup-plugins/](https://www.fixrunner.com/best-wordpress-backup-plugins/) (I primarily use All in one WP migration plugin, and BlogVault and SG hosting backup system)