Home » Remove Duplicate Custom Fields From WordPress Using SQL Query

Remove duplicate custom fields from WordPress using SQL query

After a redesign of a clients website and move to the new hosting environment we had experienced some problems with custom fields.

While importing the posts to the new SQL something went wrong and we ended up having duplicates of the custom fields on each and every post.

THE PROBLEM:

Duplicate custom fields on posts.

duplicate custom fields

Larger database size

THE SOLUTION:

Remove duplicate custom fields from WordPress using SQL query

  1. Identify the duplicated fields from within your post.
  2. Go to your phpMyAdmin and select your database.
  3. Run the query from the code below and make sure to change the keys to match the ones you want to remove.
  4. Repeat

sql explanation