WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have about 50 custom fields I need to delete at once, going through each one and deleting one at a time would take too long because it takes about 4 seconds for a page to load and I just don't have time to do that.

I need to delete them because I previously used a plugin called Advanced Custom Fields (ACF), but apparently it doesn't work well together with qTranslate, so I'm replacing ACF with another plugin called Types, which does pretty much the same thing a little uglier. The problem is, even after deleting all custom field groups with ACF, the fields are still there! And I need to remove them because otherwise I can't create new fields with the same name with Types.

I found a plugin called "Delete Custom Fields" but it didn't work.

Any other ideas on how to delete all of them at once? Can I manually delete the fields from the database?

EDIT: I should also mention you can manage custom fields from within Types, but appareantly you can only manage the ones that are "under Types' control" a.k.a. the ones created by Types, so that didn't work.

share|improve this question
up vote 0 down vote accepted

You can use the SQL way. Go in your database tool, like phpMyAdmin or Adminer (also possible via Plugin in the WordPress back-end). Use the SQL area for creating custom queries.

Before you start, create a backup of the database and also a single backup for the table _postmeta.

Change the string wpbeta_2 to your prefix, this is only a example.

Get all fields that have a custom field:

SELECT *  FROM `wpbeta_2_postmeta` WHERE `meta_key` != ''

Now you have a list of all fields, check this.

Delete a specific field:

DELETE FROM `wpbeta_2_postmeta` WHERE `meta_key` = 'modules'

Delete all fields:

DELETE FROM `wpbeta_2_postmeta` WHERE `meta_key` != ''
share|improve this answer
But, that's pretty much the same as truncating the table!? You delete all rows where meta_key is not empty, and why would meta_key ever be empty? Anyways, i took a backup and wiped the table as suggested, hopefullly i wont need to restore the backup! – qwerty Oct 18 '12 at 12:06
Yes, but you have also the chance to check all values, there not start with _. The values in meta_key, there start with _ is from plugins or theme and not visible in the custom fields. – bueltge Oct 18 '12 at 12:58
@stealthyninja Thanks for the correction! – bueltge Oct 18 '12 at 13:22

Using Types you CAN take over control of your existing custom fields. You don't need to delete them. Look under the Types--> Custom Field Control, select the fields and Bulk Edit to "Add to Types Control"

share|improve this answer

For removing all, open phpmyadmin, go to wordpress database & truncate the table wp_postmeta

if you want to delete them for some particular post id search for that post id in the respective column & delete all those found

share|improve this answer
I just noticed that, but is that really safe to do? It does not only contain custom fields, but also tons of other data (i have like 20 fields max, there's over 2k of rows in that table). – qwerty Oct 18 '12 at 11:53
20 fields X 100 posts = 2k rows – Mridul Aggarwal Oct 18 '12 at 12:12
But i have 4 posts and about 10 pages... – qwerty Oct 18 '12 at 12:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.