how to clean up wordpress database

For many, the New Year brings forth a clean slate and fresh hope that the next 365 days will bring more success and prosperity. People begin the year by cleaning their homes; removing clutter, throwing out useless “stuff”, and organizing the different areas. Likewise, your WordPress database needs to be cleaned up of clutter, useless stuff, and have its files organized so that it can perform optimally for the next 365 days.

Over the course of the previous year, your WordPress website has seen plenty of activity. It may have undergone site revisions, received spam comments, saved drafts, and stored data from old plugins, trackbacks, and pingbacks. Removing all of this clutter will free up space in your database and allow your website to run faster.

WordPress highly recommends that you frequently clean up your WordPress database to ensure top-level performance and user experience. And cleaning up your WP database might be easier than cleaning out your home!

What Should You Clean Up On Your WordPress Database?

Before we get into the specifics of how to clean up your database, we recommend that you first backup your website. Yes, cleaning up the WordPress database is easy but it’s better to be safe than sorry. You want to have peace of mind just in case anything goes wrong during the process.

If you’re thinking “Oh, no! I don’t know how to backup my website!” 

Don’t worry as we’ve got you covered!

There are many WordPress plug-ins that you can use to backup your website. Once installed, the plug-in will run the backup for you. 

Here are 5 plug-ins that we highly recommend:

If you want to learn more about how and why you should backup your WordPress website, you can read our article “How Often Should You Backup Your WordPress Website?”

Once you’ve successfully backed up your WordPress website, what items should be cleaned out of your databases? 

  1. Data from old plug-ins – One of the key procedures to protect your website from cyber-attacks is to remove unused plug-ins. However, after you’ve removed them, some data might be left over. Make sure your database is 100% cleaned of the plug-in files and data. 
  1. Data from old posts – You’ll have data leftover from posts you made in the past. These can be found at the wp_postmeta table.
  1. Spam comments – When your website is popular and has elicited a high-level of engagement, there are some people who will use the comments section to put links to other websites. This is an unethical practice that Google frowns upon. Likewise, visitors will be turned off by spam comments that take them to spurious websites. 
  1. Unapproved comments – Unapproved comments are types of content posted by commenters that may be deemed inappropriate. For web pages where comments don’t require approval, having these comments visible to everyone might affect your reputation. Likewise, unapproved comments can invite spammy links to your website and compromise your SEO strategy. 
  1. Unused tags – We discussed the value of attaching tags to your content. Over the course of publishing content, there may have been instances where you changed your mind and replaced the tag. There will be leftover data that could be removed.
  1. Transients – WordPress, as well as some apps, have a feature that allows you to temporarily store cached data in your website’s database for a specified time frame and under a filename. This type of data is called a transient and takes up a lot of storage space. Once transients have accumulated, they will significantly slow down your website. 

What Plug-Ins Can You Use To Clean Up Your WordPress Database?

Similar to backing up your website, there are plug-ins that you can install to make it easier for you to clean up its database.

Here are 3 of the WordPress plug-ins we recommend for cleaning up the database of your website. These plug-ins are free. We’ve used them on our clients’ websites and can attest to their effectiveness.

1. WP-Rocket

WP-Rocket is one of the most popular cache plug-ins in the market. We use WP-Rocket extensively with our clients because it’s also a terrific optimization tool. 

It’s a no-fuss, plug-in with many amazing features that are designed to help your website perform better. 

WP-Rocket sets up easily on your website. No need to configure. All you have to do is to activate the plug-in so it can go to work right away. 

Its interface is very intuitive that beginners will easily see the sections they need to cleanout. WP-Rocket also allows you to schedule database cleanups. Choose your preferred frequency – daily, weekly, or monthly – and WP-Rocket will clean up your databases automatically.

2. WP-Optimize

WP-Optimize has been downloaded more than 600,000 times for one reason: it does the job of cleaning up your WordPress website perfectly! WP-Optimize also enables you to compress images to free up memory and improve website speed. 

Another wonderful feature of WP-Optimize that gives your website’s speed a boost is the ability to cache your web pages. Caching stores memory-heavy data in a temporary file that your site visitors can access anytime. 

You can read more about caching in our article “What Is Caching And Why It’s Important For Your Website”.

WP-Optimize makes it easy for you to clean up your database. Its Table Information section shows you all the databases and their respective sizes. There are plenty of cleaning options to choose from. To activate, simply click “Run Optimization”.

Similar to WP-Rocket, you can schedule the automatic clean up of your databases with WP-Optimize.

3. WP-Sweep

WP-Sweep is a plug-in that is fast gaining users largely because it was created by Lester Chan, a highly respected WordPress developer. 

And Mr. Chan’s plug-in delivers the goods!

Like WP-Rocket and WP-Optimize, WP-Sweep is very easy to use. It only uses a single button “Sweep All”  to clean out the following items:

  • Transients
  • Post revisions
  • Spam comments
  • Unapproved comments
  • Auto-drafts
  • Unused terms
  • Duplicate metadata

Of course, you can be more selective and click “Sweep” beside the item you want to be removed.


How often should you clean up your WordPress website?

The schedule of cleaning would depend on the size of your website and its level of activity. 

If you are consistently uploading content, updating features, and if your website is enjoying plenty of traffic plus high engagement, you should clean up your databases more frequently. 

A good rule of thumb for busy websites would be to run cleanup activities once-a-month.

The key takeaway is that websites over time accumulate clutter and must be cleaned up to maintain speed, improve performance, and ensure functionality.

Your best option to keep your website healthy and running at optimal levels is to sign up for one of our Extreme WordPress Care Plans and allow us to do everything for you! 

With Extreme WordPress Care Plans, you can sleep soundly knowing that your website is being watched by a team of experts. 

We’ll run the updates, initiate backup and cleanup activities for you as well as keep your website protected from hackers. If you want to learn more about our Extreme WordPress Care Plans give us a call. 

And if you enjoyed this article, please feel free to share it with your community.