Once you have located the plugin, click the “Install Now” button.
Click the “Activate” button.
Step 2: Backup WordPress (Optional)
Before diving into the Media Cleaner plugin, it’s crucial to discuss the importance of backing up your WordPress site and database. Regular backups are a good practice for safeguarding your data.
Particularly, before using a tool like Media Cleaner, you should ensure that you have a recent backup. The plugin removes files from your server, and these deletions are usually permanent. There’s always the possibility of mistakenly deleting something you might need later.
So, maintain regular backups and make sure to create one before using Media Cleaner. Remember, you can never have too many backups.
While you’re at it, don’t forget to back up your computers as well. Although it might seem inconvenient and like a waste of time if you never need them, the peace of mind and the relief of having a backup when you do need it are invaluable.
Step 3: Set Up the Media Cleaner
- In the left sidebar, hover over the “Meow Apps” link.
- Click on the “Media Cleaner” link.
The free version of the plugin is limited to scanning the Media Library, so most of the settings can be left as they are by default.
This makes the WordPress library plugin an excellent choice as it is easy to use.
One thing you may want to do is check the box to save a log of what the plugin does. That way, if something is removed that you didn’t want to be deleted, you may be able to restore it from your backups using the information from the logs.
Click the “Enable” box in the “Logs” section.
Click the “Save Changes” button.
Step 4: Clean the Media Library
In the left column navigation mouse over “Media” and click the “Cleaner” link.
There are a lot of warnings and messages on the Cleaner page. Look for one that says, “The trash for the Media Library is disabled.” If you see that message, you can enable Media Library “trash” by adding:
1
|
define( 'MEDIA_TRASH', true ); |
to the top of wp-config.php. That should make it possible to retrieve deleted media files.
To begin cleaning, click the “Start Scan” button.
If the plugin finds images that are not related to a page or post, you’ll see an “issue(s) found” message. Click the “Refresh” link to display the unused images.
If the images appear to be safe to delete, you can select the image checkboxes and click the “Delete” button.
Or click the “Delete all” button.
Either of these options will delete the unused images from WordPress.
Note: In my testing, I found it preferable to select the images and click the “Delete” button. Clicking the “Delete all” button sometimes permanently deleted images (even though Media Library trash was enabled).
Step 5: Restore Files (If Needed)
If you have enabled the Media Library “trash” by editing the wp-config.php file as noted above, you may be able to retrieve deleted images.
To see the files that have been moved to the Trash directory, open the Media Library and select “Trash” from the drop-down.
Click the image you want to retrieve and scroll down to the bottom of the popup window. Click the “Restore from Trash” link.
And that marks the end of the tutorial. Feel free to delete the plugin when you are done with your cleaning. You can safely reinstall it and delete it as many times as you need.
Any time you’re able to keep WordPress cleaned up only benefits its performance, this includes a media library cleanup. This is especially true if your hosting is limited in space or taking up too many resources.
To Clean or Not to Clean
Using a plugin that deletes files can be nerve-wracking. However, the “pro” version of Media Cleaner offers a more comprehensive and presumably safer experience. It might be the top choice for cleaning up WordPress media files.
That said, with caution, the free version can also be used effectively. As long as you’re diligent about creating backups and have enabled the Media Library trash feature, you can recover from any accidental deletions.
The necessity of removing unused image files from your site depends on individual needs. For many, it may not be essential. However, for older sites or sites with numerous deleted posts, a file cleaner can reduce the load, making backups faster and less storage-intensive.
Moreover, some people simply enjoy keeping things organized. There’s nothing wrong with that! Cleaning up the media library can be an easy way to tidy up and maintain an orderly site.
Bonus Plugin: Media File Renamer
The same developer behind Media Cleaner also offers another useful tool called Media File Renamer. This plugin is noteworthy because it serves an important function.
For instance, in my WordPress test setup (using WordPress Theme Unit Test data), the plugin suggests more descriptive names for image files, as shown in the following screenshot. This can help improve organization and SEO.
As you can see, these image name suggestions can be quite helpful for SEO purposes. Google indexes images and prefers descriptive filenames like over generic ones like The default camera filename doesn’t convey what the image is about, whereas does.
Thus, the Media File Renamer is worth exploring. The plugin generates image filename suggestions based on the image title provided during upload. If you don’t title your images upon upload, the plugin’s usefulness might be limited, but it’s still a valuable tool to consider.
Save Space and Money by Deleting Old Files
It’s important to address the cost implications of storing unused files. Many web hosting plans come with a limited amount of storage space, and exceeding this limit often requires an upgrade, which can be costly.
Moreover, consider the expenses associated with backups and cloud storage. Every website should have at least one backup, ideally more. Some backup services charge based on the amount of data, so reducing the size of your site can lead to cost savings.
Additionally, storing large backups can be challenging. The larger the backup, the more difficult it becomes to manage and store the data efficiently. Therefore, regularly cleaning out old, unused files can help save both space and money.