Delete WordPress Custom Fields from Database with phpMyAdmin

Posted on May 4, 2015 in WordPress Category with Medium Difficulty

In this tutorial you will learn how to delete empty or unused custom fields in WordPress from your database using phpMyAdmin, but make sure to let the other custom fields used by plugins to not cause any problems.

Video Tutorial

Check for Unused Custom Fields

In order to check if you have unused custom fields, simply add a new post. Here, if you cannot see the custom fields panel, you can activate it by going to Screen Options, located in the top right corner (near Help button) and mark the check-box.

Then you should find your panel in the same page. As you can see in the image below you can only add new custom fields or existing ones, but you can't remove them.

Set WordPress Custom Fields inside Post

Remove Empty Custom Fields from Database using phpMyAdmin

If you are using cPanel or any other hosting control panel, search for phpMyAdmin so we can remove custom fields from database.

phpMyAdmin in cPanel

Find your database that you use it in WordPress's wp-config.php  and search for _postmeta database table on the left side panel. Once you are inside it, click on the search button to search within the table you selected.

phpMyAdmin Search Custom Fields Meta Key in Database

Keep in mind that in this database table are not only custom fields. Be careful what you are searching if you plan to delete something. Custom fields names are defined in the meta_key column.

If you choose the LIKE operator (as it is in the image above) it will match every entry containing the value you have added, which will be the name of the custom field. If you choose the equal = operator it will match exactly the value added.

Delete WordPress Custom Fields from phpMyAdmin Database

In the picture above, I used a custom field named "difficulty" to define my tutorials how hard they are. If you delete every entry, that custom field will not be anymore available in WordPress database, only if you add it again inside another post or article.

Known Problems

Plugins may or may not use custom fields. Usually if you find any values used on them, it means they are used with a scope. If you think that custom fields is used somewhere in your back-end or front-end do not delete it.

To avoid any malfunctions to your WordPress, make sure to backup files and databases first and run a test. If everything works correctly, your custom fields list is now shorter.

Related Articles
  1. Bhumi says:

    Nice post. Thank you so much for sharing.

Hint: Wrap your code syntax (html, css or others) between <pre> and </pre> tags. All comments are moderated.

one × = 9

Subscribe by E-mail

HTML-TUTS is built under the mighty WordPress platform.