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.- 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.
- Now open your website’s database and browse structure for the table “wp_postmeta”.
- Now click on “Browse distinct values” against the “meta_key” entry. “meta_key” is the column which stores all the custom fields.
- 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.
- 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.
- Now this will return you all the entries which have “Description” as the “meta_key” value.
- 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.