Once you’ve cleaned up and deleted unused plugin tables in your database, you may also want to find and delete unused images in your media library.
There’s different plugins which enable you to do this which i have tested on a local installation of WordPress.
Of course you could also go through your files in the media library and delete your unattached files manually but that just isn’t a fun way to use WordPress.
Let’s take a look at 2 plugins which make the job easier & faster.
Note: WordPress creates 4 copies of each image every time you upload them to your server via your media library. This plugin finds the image files which have not been used within a post or page and displays them for deletion from both your uploads directory and database. Images you have uploaded and used in other area’s of your site will also be displayed.
WordPress Uploaded Files Cleaner
Once you install and activate this plugin, go to settings to find the link to this page.
I suggest you analyze one folder at a time rather than select every year.
The reason for this is the plugin does take a while to scan all your uploads depending on how many images in each folder.
Your unused images will then be displayed on the next screen.
You can then move these files from your uploads folder to a dedicated folder.
Let’s now check out another plugin which pretty much does the same job.
DNUI ( Delete Not Used Images)
After activation of this plugin, go to settings to find the link to the page where the action takes place.
Here’s a tutorial you can follow directly from the plugin authors website.
Once you make a scan, the unused images will be displayed.
You can view the images before deleting all the copies WordPress automatically creates of them.
This plugin worked for me no problems.
Deleting Images Manually
You can also search through your Media Library for images which are unattached to posts and pages to delete them manually.
Simply go to Media > Library and click the Unattached link which will display all images that may be displayed on other parts of your site or simply not used.