Cleanup Duplicate Meta
Cleanup Duplicate Meta
Description
There are times when your database gets filled up with duplicate entries that you may not want. Cleanup Duplicate Meta allows you to check for any duplicates in either the Post Meta or User Meta tables. Then if you want to get rid of them, simply click on the Cleanup button and Cleanup Duplicate Meta deletes the duplicates leaving either the first or last meta (you select which).
The interface is simple and easy to use:
- ‘Check for Duplicates’ queries the database and then displays all the duplicates found.
- ‘Count Duplicates’ counts all the duplicates found in the database (i.e. a total count).
- The ‘Cleanup’ buttons trigger a SQL query to run, which deletes each of the duplicate entries, leaving either the first or last one (per your selection) in the database. All non-duplicates remain untouched by the plugin.
See the screenshots tab for more details.
Installation
From your WordPress dashboard
- Visit ‘Plugins > Add New’
- Search for ‘Cleanup Duplicate Meta’
- Activate Cleanup Duplicate Meta from your Plugins page.
Once Activated
- Go to ‘Tools > Cleanup Duplicates’
- Click on the ‘Check for Duplicates’ button for either Post or User Meta.
- If there are duplicates, you can then click on ‘Cleanup Post Meta’ or ‘Cleanup User Meta’ button.
Screenshots

The plugin's page in Tools > 'Cleanup Duplicates'.

Screen for both the Post Meta and User Meta controls.

An example of the table generated when clicking on 'Check for Duplicates' button. The results are sorted by meta key.

After clicking on the 'Count Duplicates' button, notification is displayed of the number of duplicates found (which could be deleted).

The message after clicking on 'Cleanup Post Meta'.
Faq
How do I check how many duplicates are in either the Post Meta or User Meta table?
Simply click on the ‘Check for Duplicates’ button and the plugin will report the count back to you on the screen.
See the screenshot 2 for an example.
How do I know whether to leave the first or last one?
If you know which one you want, then select either the first or last one. Otherwise, leave it at the default.
Should I backup my database first?
Yes. Before you run Cleanup, you should backup your database.
Will this work on WordPress multisite?
Yes!
What happens to non-duplicates when I run Cleanup?
Nothing. Cleanup Duplicate Meta does not touch non-duplicates. Therefore you’re data remains intact.
Reviews
Wow! It saved my site!
By Andre (a.grundner@greenitsolutions.at) on March 5, 2021
Works perfect
By Rocket Apps (mikeyott) on September 25, 2020
Still works
By tomfaber on September 11, 2020
Tonya Mork is a GENIUS. Plugin Still working in 2020
By ctrlaltdelete on March 28, 2020
Old but works!!
By goddess_dix on September 25, 2018
Really handy plugin
By Luke Cavanagh (lukefiretoss) on July 24, 2018
Works great
By discsox on April 28, 2017
Easy to Use and Helpful
By Anonymous User 7698158 (anonymized_7698158) on September 3, 2016
This plugin is perfect when working with a client database that has not been maintained properly. Goodbye duplicates. Thank you!
Great Plugin
By Evan Herman (eherman24) on September 3, 2016
I was just about to write up my own plugin as a soltuion to clearing duplicates when I can across this plugin.
Cleanup Duplicate Meta is an awesome plugin that just saved me a good deal of time. Within a few minutes of installing the plugin I had successfully purged around 3,200 duplicate entries from a clients database (after taking a backup ;]).
Thanks for putting this plugin up in the repo for others to take advantage of!
Evan
Changelog
Version 1.0.2
- Added in missing files to repo
Version 1.0.1
- First release