Type to search.

#292 by installs

WP-Sweep

by Lester ChanVersion 2.0.1

WP-Sweep allows you to clean up unused, orphaned and duplicated data in your WordPress. It also optimizes your database tables.

Active installs
100,000+
#292 of 1,000
Downloads, all time
2.3M
2,256,409
Downloads, 30 days
25.5K
6K in the last 7
Rating
4.7 / 5
138 reviews
Last updated
2 months ago
Aug 24, 2026
Version
2.0.1
21 releases

Upkeep and compatibility

Last updatedAugust 24, 2026Updated in the last 3 months
Tested up toWordPress 7.1.4Covers WordPress 7.1.4, the current release
Needs WordPress6.8 or newer
Needs PHP8.2 or newer
First publishedFebruary 25, 2015
Support, last two months1 of 1 threads resolved (100%)

Reviews

4.7 / 5 from 138 reviews

Reviews by star rating
5 stars125
4 stars1
3 stars1
2 stars1
1 star10

Downloads, last 30 days

Low 373 a dayHigh 2.5K a day

What the author says it does

WP-Sweep finds the rows WordPress leaves behind and removes them. Revisions of posts you edited years ago, meta belonging to a post that was deleted, terms attached to nothing, term relationships pointing at posts that no longer exist, expired transients: none of it is visible anywhere in wp-admin, and all of it is in your database.

It uses the proper WordPress delete functions wherever they can reach the row, rather than running raw delete queries, so the hooks other plugins rely on still fire. Only the rows the API refuses to touch — orphaned meta whose object ID is 0 — are deleted directly.

Features

  • Revisions
  • Auto drafts
  • Deleted posts
  • Unapproved comments
  • Spammed comments
  • Deleted comments
  • Orphaned post meta
  • Orphaned comment meta
  • Orphaned user meta
  • Orphaned term meta
  • Orphaned term relationships
  • Unused terms
  • Duplicated post meta
  • Duplicated comment meta
  • Duplicated user meta
  • Duplicated term meta
  • Transient options
  • oEmbed caches in post meta
  • Optimizes database tables

Delete functions used

  • wp_delete_post_revision()
  • wp_delete_post()
  • wp_delete_comment()
  • delete_post_meta()
  • delete_comment_meta()
  • delete_user_meta()
  • delete_term_meta()
  • wp_remove_object_terms()
  • wp_delete_term()
  • delete_transient()
  • delete_site_transient()

Known incompatibilities

The opening of the plugin's own description. The full text, installation notes and changelog are on its WordPress.org page.

Questions the author answers

The Tools -> Sweep screen has a new address

It is still under Tools, but the address changed from tools.php?page=wp-sweep/admin.php to tools.php?page=wp-sweep. Update any bookmark.

The old address was the legacy “plugin file as menu slug” form, which put the plugin’s installation directory name into the page URL.

Where did Sweep All go?

Every row has a checkbox and the table has a Sweep bulk action, so ticking the header checkbox and applying it does what Sweep All did — and lets you leave out the ones you do not want.

My snippet calling WPSweep::get_instance() stopped working

The classes are renamed in 2.0.0:

  • WPSweep is now WP_Sweep
  • WPSweep_Api is now WP_Sweep_API
  • WPSweep_Command is now WP_Sweep_Command

So WPSweep::get_instance()->sweep( 'revisions' ) becomes WP_Sweep::get_instance()->sweep( 'revisions' ). There is no compatibility alias, so the old name raises a fatal error rather than failing quietly.

Every filter and every wp_sweep_admin_*_sweep action keeps the name it had.

Which filters can I use to protect data from being swept?

Four per-type filters take a list of meta keys that must never be deleted, and each supports * as a wildcard:

add_filter( 'wp_sweep_postmeta_whitelist', function ( $keys ) { $keys[] = '_my_plugin_setting'; $keys[] = '_acme_*'; return $keys; } );

A key I protected was swept anyway, or far too much was kept

Before 2.0.0 the exclusion was a SQL LIKE clause, and LIKE treats an underscore as a single-character wildcard. A pattern of _my_key therefore also matched Xmy!key, and a good deal else. Matching happens in PHP now, so an underscore is an underscore and only * is a wildcard. Check your list if you were relying on the old behaviour.

Does WP-Sweep leave anything behind when I delete it?

Nothing. WP-Sweep stores no option rows, creates no database tables, registers no capabilities and schedules no events. uninstall.php runs anyway and sweeps up after itself across a whole network rather than the first hundred sites.

Latest changelog entry

2.0.1

  • NEW: A Sweep link on the plugin’s row of the Plugins screen, opening Tools -> Sweep.
  • FIXED: The Sweep screen timed out on large databases. 2.0.0 computed every count before printing a byte — and asked for each table’s total row count once per row instead of once, so SELECT COUNT(*) ran against the postmeta table four times per load. The screen now renders at once and fetches the counts afterwards, one request at a time, so no single request outlives PHP’s time limit.

Screenshots

From WordPress.org.

Tagged

Plugins that share its tags

#702 by installs

WP-DBManager

by Lester Chan

Manages your WordPress database.

Installs
50,000+
Rating
4.4 (95)
Updated
3 months ago

#5 by installs

LiteSpeed Cache

by LiteSpeed Technologies

All-in-one unbeatable acceleration & PageSpeed improvement: caching, image/CSS/JS optimization...

Installs
7+ million
Rating
4.8 (2.8K)
Updated
11 days ago

#73 by installs

W3 Total Cache

by BoldGrid

Search Engine (SEO) & Performance Optimization (WPO) via caching. Integrated caching: CDN, Page, Minify, Object, Fragment, Database support.

Installs
900,000+
Rating
4.4 (5.4K)
Updated
11 days ago

#77 by installs

Autoptimize

by Optimizing Matters

Autoptimize speeds up your website by optimizing JS, CSS, images (incl. lazy-load), HTML and Google Fonts, asyncing JS, removing emoji cruft and more.

Installs
800,000+
Rating
4.7 (1.4K)
Updated
6 days ago

Where this page's numbers come from

Read from the WordPress.org plugin API on , when WordPress 7.1.4 was the current release. WordPress.org rounds active installs into buckets. These are the directory's figures, not my verdict, and I haven't tested this plugin. The author takes donations at their donate page.