A website and its associated backend tend to build up “crud” as time goes by. Especially if you’re running a complicated CMS like WordPress with a lot of moving parts. This dirt accumulates mainly in the database even if you don’t make any active changes to your site. Automatic plugin updates, cron jobs, user interactions, and other activities, all leave a trace that slowly builds up and can slow down your site. Even if there’s no direct performance impact, it’s good practice to manage website hygiene and regularly perform maintenance on your site so that gets cleaned out.
Here are four tasks that you should do at least once every few weeks to keep your website well-maintained.
1. Optimize your Database
Your WordPress database accumulates inefficiencies over time. Even after improvements to the backend database architecture, some claim that there’s no need to optimize the tables anymore. The jury is out on that one. But there’s no harm in doing it anyway. Here’s a full list of what exactly the “optimize” function does for MySQL databases.
According to the above link, optimizing the table improves the storage for both the data and the indexes, thereby increasing the I/O efficiency. So doing this now and then is a good idea.
2. Cleaning out Outdated Post Revisions
By default, WordPress keeps a long list of revisions for each post and page. These tend to accumulate very fast. Especially if you have an active site with multiple writers, it can quickly take up a lot of new entries. While having these revisions is a good thing, you should first of all set a limit on how many WordPress revisions you want to keep. You can easily do this with a variable in the wp-config.php file.
But now and then, you should clean out outdated post revisions to compact your database. By default, WordPress doesn’t have a limit for how many revisions it saves. So cleaning these up can yield huge benefits in terms of space and efficiency.
3. Delete Unused Image Files
This is riskier, but if you do this after a long time, you can save tons of disk space. As you modify and delete posts, media images that you used to use will be no longer needed. By default, these stay on your server forever. Over time, there’s no easy way to know if a particular image on your site is being used or referenced anywhere in your content.
For small sites, this might not be a problem. But sometimes the unused media files can keep growing till eventually, they use several GB of disk space. If you have an incremental backup solution, these unused media files have knock-on effects by increasing the time it takes for each backup and making you pay for more space.
4. Clearing out Spam Comments
This one is much easier to do. Occasionally, just empty your spam comments and you’re done!
Tools to Automate WordPress Maintenance Tasks
In the long run, it’s best to do these tasks automatically at regular intervals – except for cleaning unused media files. Never do that automatically! The tool I find helpful for cleaning the database via optimization, getting rid of post revisions and even spam comments is Advanced Database Cleaner. With this plugin, you can get rid of outdated post revisions, spam comments, pingbacks, and more:
In the “Tables” tab, you can also optimize your tables:
The best part is that you can set schedules for when you want these actions to occur. So it’s a “set it and forget it” plugin where the free version does a very good job by itself. The “Pro” version is a one-time license, which is refreshing since there’s no annual fee to continue receiving updates.
Removing Unused Media Files – Take Care!
To remove unused media files, I suggest the Media Cleaner plugin. Here’s a screenshot of the unused media files I found on my test WordPress installation:
You MUST heed the big warnings this plugin shows you before you decide to delete anything. Take a full site backup, including your “uploads” and the database as well so you can restore them if anything goes wrong. DO NOT use this plugin unless you’ve taken a backup.
Because of how dangerous this can be, I suggest you perform this action infrequently. The other maintenance tasks are relatively risk-free, and you can do them once a week if you like. For unused media files, I suggest once a year, maybe!
These maintenance tasks will keep your WordPress site clean and crud free. Enjoy having a squeaky clean installation!
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!