Clean Up Unused, Orphaned And Duplicated Data In WordPress Database With Proper Functions

WP-Sweep is a WordPress plugin that uses regular WordPress functions to clean up database clatter of your website and get optimized database tables for better performance.

Unlike to other database plugins, even the most popular one called WP-Optimize, this plugin uses proper WordPress delete functions as much as possible instead of running direct delete MySQL queries. 

It uses following database functions:
  • wp_delete_post_revision()
  • wp_delete_post()
  • wp_delete_comment()
  • delete_post_meta()
  • delete_comment_meta()
  • delete_user_meta()
  • wp_remove_object_terms()
  • wp_delete_term()
  • delete_transient()
  • delete_site_transient()
In order to clean up:
  • 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
  • Optimizes database tables
  • oEmbed caches in post meta

Note: Before starting, make sure to keep a backup of your WordPress database.

Start by installing ‘WP-Sweep’ plugin in WordPress

Upon activation, visit your admin area dashboard Tools -> Sweep to clean up and optimize your database. Here the plugin will display information and details on how much useless data you have on your database and how much you can clean up with this plugin.


All details are divided into various sections separate for posts, user meta, terms, comments, options and database optimize.

You can either clean up clutter individually by clicking the ‘Sweep’ button or scroll down and use sweep all option to clean up all clutter collectively. Sweep all option may take sometime depending upon how big your database is in size, it displays you the progress on the page.

Leave a Reply

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