WordPress Plugin
Smart Media Cleanup, Folders & Image Optimization
Manage your media library with ease. Automatically delete unused files, organise images into virtual folders, bulk clean orphaned files and optimise every photo to WebP the moment it is uploaded, without touching any code.
SMART MEDIA CLEANUP (FREE PLUGIN)
Smart Media Cleanup is a free WordPress plugin that solves two of the most common problems on content-heavy websites: unused files piling up in the media library, and heavy photos uploaded straight from a phone or camera. With three core tools, automatic deletion when posts are deleted, virtual folders for organisation and image optimisation on upload, it keeps your library clean, organised and lightweight, with no extra work.
New in version 1.2.0: Image Optimisation on Upload
Site users can now upload photos as they are, straight from a phone or camera. The plugin processes every image the moment it is uploaded, before WordPress creates the thumbnails:
- Automatic downsizing to a maximum dimension you set (default 1920px)
- Conversion to WebP (or AVIF) at the quality you choose
- Correct photo orientation and removal of camera data, including GPS location
- Support for iPhone photos (HEIC), when the server supports it
- Deletion of the heavy original file or, if you prefer, a private copy kept
- All thumbnails are created in WebP as well
A phone photo of several MB usually becomes a few hundred KB, with no visible difference in quality. The feature is disabled by default and you enable it from Media Cleanup → Image Optimization.
Features
- Automatic media deletion when posts, WooCommerce products or custom post types are permanently deleted
- Usage check before every deletion: images used elsewhere are never deleted
- Virtual folders in the media library, organised automatically by content type and post
- Drag & drop images directly from the library into any folder
- Bulk assignment: select multiple images at once and move them to a folder in one click
- Folder search: useful when you have hundreds of content categories
- Create, rename and delete folders via a modal, with no browser pop-ups
- Orphaned file scanner with bulk deletion in batches (does not hang on large libraries)
- Image optimisation on upload: downsizing, conversion to WebP/AVIF and removal of camera data
- Support for iPhone photos (HEIC)
- Warning if another image optimisation plugin is also active
- Activity log for deletions and optimisations, with automatic cleanup of old entries
- Support for WooCommerce, Elementor, JetEngine, Yoast SEO, RankMath, ACF
Installation
1. Download the plugin .zip file
2. Go to your WordPress admin > Plugins > Add New > Upload Plugin
3. Select the .zip file and click Install Now (if you already have an older version, choose “Replace current with uploaded”; your settings are kept)
4. Activate the plugin
5. Go to Media Cleanup > Settings to set the content types you want to monitor
Software requirements
- WordPress 6.0 or later
- PHP 7.4 or later
- For image optimisation: Imagick or GD with WebP support (available on most servers)
Configuration
Go to Media Cleanup → Settings to:
- Choose which post types are monitored for automatic deletion
- Add custom meta keys that store image IDs (e.g. gallery fields from JetEngine or ACF)
- Set whether deletion happens only on permanent deletion or also when moving to the Bin
- Enable or disable the usage check before every deletion
- Run the Sync All Posts to Folders to automatically assign existing images to their folders
Go to Media Cleanup → Image Optimization to:
- Enable image optimisation on upload
- Set the maximum dimension and quality
- Choose the storage format (WebP, AVIF or the original format)
- Choose whether to keep a private copy of the original file
- Skip thumbnail sizes your theme does not use
Version
1.2.0
Licence
GPL v2 or later
Support
All plugins work properly and are compatible with the latest versions of WordPress and WooCommerce.
If you have any questions, we will be happy to help!
FREQUENTLY ASKED QUESTIONS
Smart Media Cleanup
Will images used on other pages be deleted?
No. The usage check (enabled by default) prevents the deletion of any image used elsewhere on the site, whether in another post, as a featured image, in an Elementor layout or anywhere else.
What happens if I move a post to the Bin instead of deleting it permanently?
With the default setting (permanent deletion), moving a post to the Bin deletes nothing. You can restore the post as usual. Media are only deleted when you permanently empty the Bin.
Does it work with WooCommerce?
Yes. It tracks WooCommerce products like any other post type. Add _product_image_gallery to the
meta keys in Settings to cover product gallery images too. Variation images are also deleted automatically.
Does it work with Elementor?
Yes. The plugin automatically checks Elementor data for image references, so images used in Elementor layouts will never be flagged as orphaned.
Can I use the virtual folders without automatic deletion?
Yes. Each feature can be enabled and disabled independently from Settings.
Do the folders also work in the library's list view?
The folders panel is available in the grid view of the media library. List view support is planned for a future release.
Can I recover deleted images?
No. File deletion is permanent. We always recommend having a backup before running a bulk cleanup on a live site.
Does it also convert images I have already uploaded to WebP?
No. Optimisation only applies to images uploaded after it is enabled. Existing images stay exactly as they are, so no page that uses them will break.
Will photo quality suffer?
No. At the default quality of 80, the difference is not visible at normal display sizes. For a photography portfolio you can raise the quality to 85-90 and the maximum dimension as far as you need.
Does it work with iPhone photos (HEIC)?
Yes, as long as the server's Imagick supports HEIC. The Image Optimization page shows whether it is supported. If not, the photo is uploaded just as it would be without the plugin.
Smart Media Cleanup User Guide
1. Initial Installation and Setup
Once you have activated the plugin, go to Media Cleanup > Settings.
Step 1: Select content types
Choose which post types will be monitored. For example, if you run a WooCommerce
store, select Product. If you have custom post types (e.g. “Cars”, “Properties”), select
those too.
Step 2: Meta keys for galleries
If your posts store images in custom fields (JetEngine, ACF, etc.), add the names
of the meta keys, one per line. Example: gallery, gallery-exterior, _product_image_gallery.
Step 3: Deletion trigger
Set when media deletion happens:
- Permanent deletion only (recommended): media are deleted only when you empty the Bin
- Bin + permanent deletion: media are deleted as soon as the post is moved to the Bin
Step 4: Usage check
Keep the “Check usage before deleting” option enabled. This prevents the deletion of images that
are used in other posts.
2. Virtual Folders
Virtual folders appear as a panel on the left of the media library (grid view).
How they are created automatically:
Every time you save a post, the plugin automatically assigns its images to the corresponding folder. The structure follows the hierarchy: Content type > Post title.
WooCommerce example:
Products
└── Blue Shirt
└── Summer Trousers
Creating a new folder
Click the + at the top of the folders panel. Type the name in the modal that appears and
click Save.
Renaming a folder
Hover over the folder and click the pencil icon. Change the name and click Save.
Deleting a folder
Hover over the folder and click the bin icon. Deletion only affects the folder
: the images are not deleted.
Viewing a folder's images
Click any folder to show only the images that belong to it. Click
All files (at the top of the list) to return to the full library.
3. Folder Search
If you have many folders (hundreds of products or posts), use the search field at the
top of the panel.
Type part of the name and the list is filtered automatically, showing only the matching folders
along with their parent folders for context. Clear the text to return to the full
list.
4. Drag & Drop Images into Folders
You can move any image to a different folder with drag & drop:
1. Press and hold the left mouse button on the image
2. Drag it to the folders panel on the left
3. Drop it on the target folder (the folder will be highlighted with a blue border)
To remove an image from all folders, drag it onto No folder (Uncategorized).
5. Bulk Assign
To move multiple images at once:
1. Click Bulk Select in the media library
2. Select the images you want to move (a blue bar appears at the bottom of the folders panel
showing the number selected)
3. Click the target folder
4. The images are moved automatically and the selection is cleared
6. Syncing Existing Images
If you installed the plugin on a site with existing content, images are not automatically assigned to their
folders; this only happens when new posts are saved.
To sync all existing content:
1. Go to Media Cleanup > Settings
2. Find the Sync All Posts to Folders button
3. Click it and wait for the process to finish
The process runs in batches and does not exhaust the server's memory, even on large
websites.
7. Automatic Media Deletion
Once you have set up the plugin, automatic deletion runs in the background with no action needed from you.
What gets deleted:
- The post's featured image
- Images whose post_parent is the current post
- Images stored in the meta keys you have set in Settings
What does NOT get deleted:
- Images used in other posts (if the usage check is enabled)
- Images used in Elementor layouts, Yoast/RankMath social images, the site logo, etc.
8. Orphaned File Cleanup
Orphaned files are images in the library that are not used anywhere on the website.
1. Go to Media Cleanup > Orphan Cleanup
2. Click Scan Library; the scan runs in batches and shows results progressively
3. Review the list of images found (showing thumbnail, file name, size and
upload date)
4. Select the ones you want to delete or use Select All
5. Click Delete Selected and confirm
*Warning: Deletion is permanent. Always take a backup before running a bulk cleanup.
9. Activity Log
Go to Media Cleanup > Log to see a history of all deletions.
- Filter by action type or date range
- Each entry shows which image was deleted, from which post and when
- The log is cleaned automatically according to the retention days you have set in Settings
(default: 30 days)
10. Image Optimisation on Upload
1. Go to Media Cleanup > Image Optimization
2. Turn on the Enable image optimization option
3. Set the maximum dimension (1920px for sites with full-width sliders, 1600px for most) and the quality (80 by default, 75 for even smaller files)
4. Select WebP (recommended) and click Save Settings
From then on, every image uploaded, whether from the media library, Elementor, JetEngine or WooCommerce, is optimised automatically. At the top of the page you can see how much space has been saved, and at the bottom what your server supports (WebP, AVIF, HEIC). Every optimisation is recorded in Media Cleanup > Log (Optimized on upload filter), e.g. “4.8 MB to 310 KB”.
*Note: Optimisation only applies to new images. Images already in the library are not changed. If you already use another optimisation plugin (Imagify, ShortPixel, Smush, etc.), keep only one active.
RELEASE HISTORY
What's new in each version
Version 1.2.0 · Image Optimisation · November 2026
- New: Image optimisation on upload (disabled by default). Photos are resized, converted to WebP or AVIF and cleaned of camera data.
- Support for iPhone photos (HEIC), as long as the server supports it.
- Option to keep a private copy of the original files.
- Option to skip thumbnail sizes the site does not use.
- Optimisations appear in the activity history.
- Warning when another image optimisation plugin is active.
Version 1.1.0 · Media Folders · July 2026
- New: Virtual folders in the media library, organised by content type and by post.
- Move images into a folder with drag & drop.
- Bulk move: select multiple images and click a folder.
- Instant folder search by name.
- “Sync All Posts to Folders” tool to put older images into folders too.
- Create, rename and delete folders.
- Deletes WooCommerce variation images when the product or variation is permanently deleted.
- Fix: settings are no longer lost when the plugin is updated.
Version 1.0.0 · First Release · July 2026
- Automatic deletion of images when a post is permanently deleted.
- Safety check: images used elsewhere are not deleted.
- Bulk cleanup of orphaned images.
- Activity history with automatic cleanup of old entries.
- Automatic detection of Elementor, Yoast SEO, RankMath and Minorank.
- Support for JetEngine, WooCommerce and your own meta fields.
- Confirmation before every irreversible action.
Ready to grow your business?
Download Smart Media Cleanup for free now.
