Media Cleaner is a very advanced tool and should be used by someone who understands WordPress very well technically. Remember to backup your install (the database and the /uploads directory) before using this plugin. I recommend you to use your hosting service backup system if they have any, a staging website if you use WPEngine or the very well-made UpdraftPlus plugin.
The Media Cleaner’s Dashboard is found under Media > Cleaner. Before doing anything here, you will need to decide your settings. However, it’s better to understand how the plugin works, and this dashboard is where the magic happens.
Here is how you should use the plugin, without going
- Scan. You can click Start
Scan ,and then enjoy a coffee. The plugin will analyze your WordPress. Once it’s done, the results will be displayed.
- Verify. There might be false-positive in those results, particularly images used by the theme directly, such as the logos, headers, etc. Look for them, and if they are part of those results, select them and click Ignore. They will never be deleted by the plugin.
- Delete or Ignore. You can search (= filter) through them. If you click Delete all after a search, only the results of this search will be deleted. You can also delete the entries one by one or by selecting a few of them. If there aren’t enough entries listed on each page for you, you can set this up differently in the settings. Remember that the files are being moved to the internal trash of the plugin, so they are still taking space in your install.
- Test and Repair (if needed). Browse your website thoroughly. If possible, let it be for a while, without adding new content.
Is a filemissing? Go back to the dashboard, click on Trash, find the entries, select them, and click Restore.
- Free space. Has everything been fine for a little while? Click on Empty trash. The entries will be permanently deleted. Good job!
Now that you know the process of Media Cleaner, let’s have a look at the settings.
The settings are found under Meow Apps > Cleaner.
- Media. Only for the Filesystem method. This will check if the files are registered in a media, including all the sizes.
- Posts. This is important as it checks the content of your posts (and any post types, such as pages, products, and so on): URLs, CSS classes using the IDs of the media, background images, src-set, and more.
- Post Meta. This is where the Featured Image is stored, but not only! Many Page Builders are keeping their data there, gallery plugins as well.
- Widgets. They sometimes contain images or even galleries.
- Logs. This will create a file (reset at every scan) containing all the files detected in your install in a first section, then the result of the scan for every media or file in a second section.
Do you have a headache already? Simply discover the different kinds of checks and actions you can perform. They represent the typical usage of Media Cleaner.
Standard Check (Media Library Method)
The basic settings for a first scan are those. I recommend you to consider Posts, Post Meta, and Widgets as a set. All of them together represents the content of your website.
Start the scan, then wait. It takes time depending on your install. If it stops suddenly, please check how to debug Media Cleaner. When it is finished, have a look at the results and firstly, search for the images used by your theme directly (usually, the header, the hero, the logo). Those might have been detected by the plugin but it is not certain, as it is often used silently by your theme. Mark them as ignored if they are part of the results.
Check the files which were detected as not in use. Are they really not in use? Check a few of them randomly, at least. Then delete them with the plugin. They will be moved to the plugin’s trash and the database entry for the media will be also kept.
Use your website for a while. Everything works? Empty the trash. Many broken files? Restore them using the Media Cleaner dashboard, or your backup.
Meticulous Check (Filesystem Method)
I recommend doing this after having checked your Media Library first. Now that your Media Library is clean, we would like to know which files in your /uploads directory are actually not registered as part of a media. I would preferably use the following settings.
All the files which are not part of a media will be detected. This makes sure that everything in your files is actually properly registered in your Media Library.
The combination of those two checks will make your install very optimized, sparkling. Everything is used and properly registered. Of course, this is ideal 🙂
Broken Media Check
Maybe you don’t really want, need or can perform a meticulous check of your install, and what you need is simply to detect the broken medias (which doesn’t have any files behind them). This scan will exactly require those settings.
Logically, doing this would actually detect all your media as not used by your system, since they are not checked against anything. But the Media Cleaner will recognize those settings and will display a message in your dashboard to let you know that it will only scan for broken media.
Delete All Thumbnails
There are plugins which are supposed to delete the thumbnails, but they actually only delete the thumbnails which are registered
Pick Filesystem as the method, then check Thumbnails Only.
In that case, it doesn’t make much sense to analyze your install for references, you will just want to get the list, then delete them. You probably want to regenerate the fresh thumbnails that you need with another plugin after that. Remember that if you don’t need all those image sizes, you can use the remove_image_size function of WordPress or plugin such as Stop Generating Image Sizes.