Delete unused custom fields in WordPress

You may have once had a custom field in your post that you don’t use any more in your theme. Whilst you don’t use it in your theme, the data remains in your database. So, to clean up your database run the following in phpMyAdmin (remember to back up your database before performing this).

Log into to phpMyAdmin and select your database. Click the SQL tab at the top of the page and enter the following details. Remember if you use a different database prefix than the standard “wp_” one, then you’ll need to change that in the text below. Replace “meta_key” with your actual custom field name.

This will then search your postmeta and delete any reference to that custom field and its data.

Leave a Reply

Your email address will not be published.