Title: Does this delete duplicate custom fields
Last modified: August 21, 2016

---

# Does this delete duplicate custom fields

 *  Resolved [Chito](https://wordpress.org/support/users/chitaranjanthoudam/)
 * (@chitaranjanthoudam)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/does-this-delete-duplicate-custom-fields/)
 * I would like to know this plugin can delete the duplicate custom field leaving
   only single value.
 * [https://wordpress.org/plugins/rvg-optimize-database/](https://wordpress.org/plugins/rvg-optimize-database/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [cageehv](https://wordpress.org/support/users/cageehv/)
 * (@cageehv)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/does-this-delete-duplicate-custom-fields/#post-4606576)
 * Hey chitaranjan,
 * Deleting duplicate custom fields is not a part of the options.
 * Besides: if the plugin finds 3 duplicate custom fields for the same page (custom
   fields with the same name, I mean) which ones to delete?
    The plugin doesn’t 
   know which one has the correct value…
 * Hope this answers your question.
 * peace,
    Rolf
 *  Thread Starter [Chito](https://wordpress.org/support/users/chitaranjanthoudam/)
 * (@chitaranjanthoudam)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/does-this-delete-duplicate-custom-fields/#post-4606750)
 * Sorry it wasn’t so clear from my side. For some reason when we add custom fields
   by plugin or from database, duplicate custom field with same value went in. So
   what I was trying to say is if there is duplicate custom field + same value, 
   delete all by leaving one.
 * Hope this make sense.
 *  Plugin Contributor [cageehv](https://wordpress.org/support/users/cageehv/)
 * (@cageehv)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/does-this-delete-duplicate-custom-fields/#post-4606815)
 * Hey chitaranjan,
 * The query to detect these duplicates would be something like:
 *     ```
       SELECT post_id, meta_key, meta_value
       FROM wp_postmeta -- change the prefix to your own prefix
       GROUP BY post_id, meta_key, meta_value
       HAVING count( * ) > 1
       ```
   
 * I think it’s not worthwhile to add it to the plugin. It’s too rare in my opinion…
   and it only would save just a few bytes in the end.
 * peace,
    Rolf

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Does this delete duplicate custom fields’ is closed to new replies.

 * ![](https://ps.w.org/rvg-optimize-database/assets/icon-256x256.png?rev=3350597)
 * [Optimize Database after Deleting Revisions](https://wordpress.org/plugins/rvg-optimize-database/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/rvg-optimize-database/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/rvg-optimize-database/)
 * [Active Topics](https://wordpress.org/support/plugin/rvg-optimize-database/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/rvg-optimize-database/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/rvg-optimize-database/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [cageehv](https://wordpress.org/support/users/cageehv/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/does-this-delete-duplicate-custom-fields/#post-4606815)
 * Status: resolved