PHPMatters Help You Better Hosting Your PHP-based Sites
The Easiest Way to Clean Up WordPress Database

The Easiest Way to Clean Up WordPress Database

If you are a WordPress user, it is highly recommended to clean up WordPress database on a regular basis. After all, as your WordPress site grows, your database simply accumulates plenty of extra data for unused plugins and themes, spam comments, post revisions, trashed items and many more, all of which can slow down your page loading speed to a large extent.

Previously, we have listed some manual tips for reducing the size of WordPress database. This time, we’d like to showcase the easiest way for the cleanup with the help of WP-Sweep or WP-Optimize plugin.

Clean Up WordPress Database using WP-Sweep

This is one of the most easy-to-use database cleanup WordPress plugins, without any requirement of technical skills. With it, you can optimize and clean your database with a single click, or optionally sweep the items of blog posts, comments, user meta, transients, database tables and some more.

To start cleaning, you firstly need to install and activate this plugin and find it from the Tools tab of your WordPress admin. Then, click the Sweep button from the dropdown menu.

As this plugin automatically analyzes your website database, you can be presented with a clear report about how much clutter you can sweep. The report is categorized into multiple groups just like the following screenshot.

WP-Sweep Plugin

  • Post Sweep – This category is mainly about your revisions, auto drafts and removed posts. Besides, there is an oEmbed Cache option that is for the damaged embedding codes for Vimeo videos and YouTube. Upon clearing, WordPress will try to fetch the new embed codes for proper display.
  • Comment Sweep – This one is for your spammed comments and deleted comments. As for the unapproved comments, you’d better make sure all of them are bad comments before cleaning them.
  • Terms Sweep – As some of the unused terms are your drafts, you need to make sure that you have no drafted posts before sweeping this option.
  • Option Sweep – This category is mainly about transient options that are used for storing your caching data. Note that what this plugin clears are all the expired transient records, so you will never lose anything upon the sweeping.

As for the clearing of these items, you can check the detailed information of each category by clicking the Details button, and hit the Sweep button optionally based on your real situations. Or, you simply need to scroll down to the bottom and click the Sweep All button to clean up all the options in one time.

Sweep Database Button

Clean Up WordPress Database using WP-Optimize

This is another widely used WordPress plugin for the cleanup and optimization of your database with extensive functions. Upon the successful installation and activation of it using your WordPress dashboard, you can find a new tab named as WP-Optimize in the left-hand column of your website back-end. Simply click it.

WP-Optimize Plugin

Now, you can be presented with a list of clean-up options including post revisions, automatically drafted posts, posts in trash, spam comments, comments in trash, comments in moderation, transient options, database tables, pingbacks and trackbacks. You can choose them optionally for the cleanup. Then, click the Process button.

In addition, the WP-Optimize plugin allows the automatic cleanup for your WordPress database on a daily, weekly and monthly basis. For this, you simply need to click the Settings button. Then, check the box to enable the scheduled clean-up and optimization, select the scheduled type and choose the cleanup options. Here, you can also enter your current email address to enable the email notification for each cleanup.

After all of these, you simply need to click the Save Auto Clean-Up Settings button. And this plugin can schedule the automatic clearing of your WordPress database based on your ultimate requirements.

Special Tips for the Utilization of These Two Plugins

Which Plugin to Choose

Without doubt, both of these two plugins are powerful enough to clean up your WordPress database in an extensive manner. However, when choosing between them, you’d better consider the following two situations.

  • If your website is fast growing which may result in a large number of useless items on your database, you’d better try the WP-Optimize plugin to enjoy its auto cleanup feature.
  • If you site is under a stable stage that only requires the constant updates, you’d better try the WP-Sweep plugin. After all, unlike WP-Optimize that operates the direct deleting on SQL queries, this plugin runs the proper WordPress deleting function, minimizing the possibility of orphaned data effectively.

Besides, WP-Sweep categorizes the cleanup items with more subdivisions and detailed information, so that you can choose to clear them in a better way.

Backup Before Cleanup

No matter what changes you want to make on your website, you’d better always keep a backup file in case any unexpected situations. And the practice of cleaning up your website database is no exception. After all, changes made by this practice are irreversible. Therefore, do not forget to back up your WordPress site before clicking the clearing button.