Clean Up WordPress with the New WP-Sweep Plugin


After years of creating new content, changing themes, and adding and removing plugins, a WordPress installation can become littered with unused, orphaned, and duplicated data. Not every plugin properly extricates itself and its data from your site when you uninstall.

Lester Chan‘s new WP Sweep plugin was designed to perform housekeeping on WordPress installations. Chan is a prolific plugin developer, who created his first plugin in 2003 shortly after WordPress was forked from b2. He now has 24+ plugins listed in directory.

WP-Sweep’s distinguishing characteristic is that it uses proper WordPress delete functions as much as possible instead of running direct delete MySQL queries. This method is in direct contrast to similarly purposed plugins such as WP-Optimize, which has been downloaded more than 1.5 million times.

What can WP-Sweep clean?

WP-Sweep uses WordPress delete functions, such as wp_delete_post_revision(), delete_post_meta(), wp_delete_comment(), etc. to clean up the database. It can perform sweeps of all of the following:

  • Revisions
  • 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

WP-Sweep can be found under the tools menu after you install it. It will give you a full overview of items that can be cleaned up.


Scroll further down and you’ll see reports for comments, users, terms, and options. Certain sweeps have extra instructions to consider before using, i.e unused terms: “Note that some unused terms might belong to draft posts that have not been published yet. Only sweep this when you do not have any draft posts.”

One user tested the plugin and reported a savings of 23.5% on database size. He also reported a bug, which Chan promptly fixed.

Chan plans to continue to develop the plugin and is considering adding unused options to the sweeps in a future version. If you want to use the plugin to clean up your website, you are strongly advised to make a backup of your database first, as the actions it performs are irreversible. Check out WP-Sweep on and favorite it for the next time you need to do some database housekeeping.


20 responses to “Clean Up WordPress with the New WP-Sweep Plugin”

  1. Sara, I’m glad you posted this.

    I’ve been using the WP-Optimize plugin daily in 3 different WordPress installations. What I never really understood was why the existence of database remnants of previously uninstalled plugins always seemed to be maintained. I posted this question on the plugin’s support forums here over 4 months ago: and even though the developer was both polite and helpful, I never got a good idea on HOW to get rid of previous plugins’ leftovers.

    Months ago, I temporarily installed BuddyPress on all 3 of those websites and bits-and-pieces of the software still remain. Because of your previous post back on February 20th here: , I started re-evaluating my usage of older plugins. Approximately 1 hour ago I disabled and uninstalled the WP-Optimize plugin, deleted my cache, installed this WP-Sweep plugin, and then ran the sweep. So far…So good. I’ll let you know how things progress (one thing I noticed is that all 3 installations updated much more quickly).

    (For me, the correct selection and usage of plugins can be confusing, frustrating, and quite a learning curve over time.)

  2. Hey Sarah
    Looks comprehensive, it’s receiving great reviews. The “Backup your database first” tip at the top of the plugin page is essential, take note people!

    There’s nothing like a bloated database to slow down a website, so it’s well worth the time invested to clean it up.

    A preventative measure is to limit the number of post revisions stored by WordPress in the database, I use a plugin called Revision Control to limit the number of stored revisions to three.


    • I was thinking the exact same thing. I assume it’s missing because he wants you to look over every option closely before sweeping, but after doing it a few times, most of us are going to want that sweep all option.

      • Sweep All (with “be careful” text), plus a Details button so you can see what will be cleaned for each area, were both added to the Beta version Lester created yesterday (see link added below by shapeshifter3). Nice improvements!

  3. Very nice. I would really like to see the ability to view what will be deleted before I use the Sweep button. For example, my site shows a few Orphaned Term Relationships. I’d like to be able to view what they are (perhaps by clicking on the number in the Count column) so I can feel more confident about pressing Sweep.

  4. That’s great news! Lester makes some really good stuff, and I expect that this will be just as awesome.

    I’ve been using a couple tools for this, and it looks like this might actually cover both of them, and if it uses legit WP functions, what’s not to like?



Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

%d bloggers like this: