How To Delete Custom Fields From WordPress

WordPress has a very useful feature of Custom Fields. These are fields that can store two things, a name and a value. A name is the thing that describes what the value stores. The name is common in all the posts with the different or same values. The custom fields are very powerful when you choose to arrange things properly. If your blog is old then you might have accumulated many custom fields that are not in use now. And it may become difficult for you to add custom fields to your new posts.

The solution is to delete custom fields that are not in use now. But WordPress does not provide any option to delete the custom fields at the front end. But we have a workaround. We can delete all the occurrences of the custom field in question from all the posts. But this again is a tedious task. What’s more feasible is to directly delete all the occurrences of the desired custom field through the database itself.



NOTE Directly editing the database can be very harmful if you take any wrong step, you could ruin your database. So it is advised to take a complete backup of your WordPress database and then start editing it.

Deleting Custom Fields From WordPress

Below is the screenshot of the custom fields which are in my website’s database. We will delete the “Description” field from it.

  1. Login to your “phpMyAdmin” console. This can be reached through your hosting account panel. If you do not know where to find phpMyAdmin you can seek help from your hosting company.
  2. Now open your website’s database and browse structure for the table “wp_postmeta”.
  3. Now click on “Browse distinct values” against the “meta_key” entry. “meta_key” is the column which stores all the custom fields.

  4. Now you will see a complete list of all the custom fields and the number of times each custom field has been allotted a value.

  5. Now suppose I wish to delete the “Description” meta field, which of-course I created for this tutorial, I will do a search in the selected table with the name of the “meta_key” (Description). Just click on search at the top and fill the values as shown in the screenshot below.

  6. Now this will return you all the entries which have “Description” as the “meta_key” value.

  7. In my case there were only two entries so I can delete them one by one by clicking the Delete button against both the entries. But you can “Check All” and delete them all together.

Once you delete all the entries of a particular “meta_key”, it will stop being displayed under the Custom Fields dop down list.
Verdict
This is an easy method to delete custom fields in WordPress, but it involves editing your WordPress database directly. So you should make sure that you have a fresh copy of your WordPress database backed up with you.
Related Post