Keeping your database clean and optimized is one of many ways to make sure your WordPress website maintains integrity. It reduces errors, keeps storage space lower and delivers a more fast and efficient experience for users. It’s vital that you perform a WordPress database cleanup on a routine basis.
Anything you can do to give your site an edge in performance is greatly beneficial. Whether it’s for the visitors or a search engine bot crawling your content, speed matters. And some of this speed is determined by the optimization of your database.
In this tutorial, I’ll go over how to delete old post revisions and other bits of useless data in WordPress. For sites that have been around for an exceptionally long time, you might experience a significant increase in performance.
Create a Backup of Your Site
Any time you make changes like this to your website, it’s always good to perform a backup. Although most plugins and functions in WordPress are stable, it’s always better to err on the side of caution. Anything can happen, an a current backup can get your site up and running in little time through a recovery.
I suggest using plugins like UpdraftPlus. It’s an easy system the grabs files and the database. Perhaps one of my favorite features is the ability to connect to Cloud storage systems like Dropbox. This means you can access the files from anywhere you have an Internet connection.
Another option may be to use FTP programs like FileZilla to download files and use phpMySQL to download the database. This is a manual process and often takes much longer to perform as opposed to WordPress plugins.
Using the WP-Sweep Plugin
For this tutorial, I’m going to demonstrate WP-Sweep. It’s an easy-to-use plugin that many people like for WordPress database cleanup. It’s received stellar reviews, even though it hasn’t been updated in a while. However, I verified it to work perfectly with WordPress 4.8.
Go to the Plugins area and click, «Add New.»
Install and activate the «WP-Sweep» plugin. You can find it by using the search field in the top right.
Go to the Tools area and click, «Sweep.»
WP-Sweep will show you the data types, number of entries and how much of the database has useless elements. If there is «0%» in any of these fields, you don’t need to do anything. However, you’ll probably see a lot of different segments that need optimizing.
Let’s click the «Details» button to see the entries you can remove.
This will give you a list of items that WP-Sweep identifies for cleaning. Over time, WordPress can easily accumulate a lot of garbage data. Let’s go ahead and perform a quick cleaning.
Click the «Sweep» button next to the component you want to clean up.
WP-Sweep will then clean up the database of those useless elements automatically. Depending on how many entries the plugin identifies, it could take a few minutes to go through all of the entries.
Fortunately, you can get rid of all these entries simultaneously in WP-Sweep.
Scroll down to the bottom and click, «Sweep All.»
You might notice Options and Database Sweeps still contain entries. You may want to examine these elements before you sweep them. There may be data you want to keep before actually removing them from the database. Once WP-Sweep eliminates these entries, they are gone for good.
This is why it’s important to keep a backup of the database. In case you delete something you need, you can easily restore it after sweeping.
What if you’re working on a draft post that hasn’t been published yet?
WP-Sweep will get rid of draft data. Before you sweep the database, make sure you publish your work. Otherwise, the content will be lost. If you’re someone who keeps drafts in WordPress to create content later, you may want to skip «Sweep All.» In that case, you can still sweep the other sections of the database and keep your drafts intact.
Why don’t you use WP-Optimize instead?
WP-Optimize does a good job at cleaning the database. However, it’s been found to leave orphaned data after processing. This means fragments of useless information can still be spotted throughout the system. This is purely a difference in program functionality between the developers. Don’t get me wrong, WP-Optimize is a good and popular tool. But some experts suggest WP-Sweep is simply better at removing and preventing orphaned data.
What exactly does WP-Sweep clean from the database?
WP-Sweep removes information that is no longer necessary for your website to function properly. For instance, WordPress will keep copies of revisions that you can go back to later. However, not everyone uses this ability and it can easily fill a database up with junk data. It also cleans up deleted comments, duplicates terms, oEmbed caches and spam elements.
Optimizing Database after Deleting Revisions is another exceptionally popular plugin with a good rating. This tool does a similar task of deleting unused data and information that is obsolete. It includes unused tags, spammed comments, pingbacks and trackbacks. To top it all off, it also supports WordPress multisite for those who have a network of websites.
Using Advanced Database Cleaner
Advanced Database Cleaner is another tool that hasn’t been updated in a while. However, it has a near-perfect rating in WordPress and has more than 20,000 active installs. It scans through and cleans all the common garbage data elements above including cron task information. It also supports multisite capablities.
WP-Optimize is one of the more popular database optimizing tools for WordPress. With over 600,000 active installs and an excellent rating, it’s safe to assume this tool is quite useful. It has far more options available for WP-Sweep and is developed to be mobile friendly. Coincidentally, this plugin automatically triggers backups with UpdraftPlus.
Keep Your System Fresh and Fast
In an age where speed is a vital part of performing well on the Internet, you need ever bit of performance you can muster to succeed. Sometimes this means running a sweep through the database or installing W3 Total Cache to improve performance. In any case, you want to give the visitor and search engines the most efficient site possible.
What kind of plugins do you use to optimize your WordPress site? How often do you clean old and unused files?