Clean Up WordPress with the New WP-Sweep Plugin

clean-up

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.

wp-sweep

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 WordPress.org and favorite it for the next time you need to do some database housekeeping.

20

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: https://wordpress.org/support/topic/deleted-plugins-remnants-recreation?replies=5 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: https://wptavern.com/new-plugin-detects-shared-terms-in-wordpress-ahead-of-taxonomy-term-splitting-in-4-2 , 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.

    Cheers
    Chris

  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?

    Thanks!!!
    Dave

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Newsletter

Subscribe Via Email

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

Discover more from WP Tavern

Subscribe now to keep reading and get access to the full archive.

Continue reading