As you use WordPress, your database accumulates a lot of extra data such asrevisions, spam comments, trashed comments, data from plugins you are no longer using, and more. Removing all this unnecessary data can significantly reduce your database size which speeds up your backup process and can add minor performance improvements as well.
Let’s take a look at how you can clean up your WordPress database.
Before you start, Make a Backup!
Before you do anything else, first create a complete WordPress backup of your site. Changes made by the clean up plugin are irreversible. Even though it does not directly mess with your posts or comments, its always better to be safe than sorry.
If you don’t like the video or need more instructions, then continue reading.
Cleaning up your WordPress Database with WP-Sweep
First thing you need to do is install and activate the WP-Sweep plugin. Upon activation, simply go to Tools » Sweep to clean up your WordPress database.
This plugin will analyze your WordPress database and show you a report of how much clutter you can clean. The sweep report is divided into different sections for your posts, comments, user meta, options, terms, and database optimize.
bottom of the page and click sweep all to clean up everything in your WordPress database.
Cleaning up may take some time depending on how big your database is. WP-Sweep will show you the progress by updating the stats on the page.
Why WP-Sweep vs WP-Optimize?
You may be wondering why are we writing about WP-Sweep when there is a very popular WP-Optimize plugin available that does nearly the same thing.
Well that’s because it’s coded by a well-respected WordPress developer, Lester Chan.
Also because the main distinguishing characteristic of WP-Sweep is that it uses proper WordPress delete functions as much as possible instead of running direct delete MySQL queries. Whereas the WP-Optimize plugin uses direct delete SQL queries which can leave orphaned data left behind.
In other words, WP-Sweep is a better coded plugin than WP-Optimize.
What all does WP-Sweep clean?
WP-Sweep uses all the proper WordPress delete functions to clean up the database. At the time of writing this article, it can clean up the following:
- Auto drafts
- Deleted comments
- Unapproved comments
- Spammed comments
- Deleted comments
- Orphaned post meta
- Orphaned comment meta
- Orphaned user meta
- Orphan term relationships
- Unused terms
- Duplicated post meta
- Duplicated comment meta
- Duplicated user meta
- Transient options
- Optimizes database tables
- oEmbed caches in post meta