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.
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:
Now you have a list of all fields, check this.
Delete a specific field:
Delete all fields:
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”
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