How To Delete Custom Field Values From WordPress Database

delete-custom-field-values-from-wordpress-database
  • Save

If your WordPress blog is old, you will notice lots of custom field meta_keys in your WordPress custom field options.

The problem with this is that you will see lots of unused custom field values which were added by some old themes or plugins which you used a long time ago.

Here is a screenshot of ShoutMeLoud’s custom field which has lots of custom values (many of which are due to old themes or plugins).

unused-custom-field
  • Save

Now, if you use a custom field to add values to your blog post, you will probably find these useless meta_keys annoying.

In this post, I will be sharing how you can delete WordPress custom fields from your database.

First, login to your phpMyAdmin account.

You can use the WP-phpMyAdmin plugin to login from your WordPress dashboard.

You will find this option under Tools > phpMyAdmin after you install the WP-phpMyAdmin plugin.

Once you are inside of your WordPress dashboard, click on your database and click on “_postmeta” (on the left sidebar).

You will see options like meta_id, post_id, and meta_key.

You should see something like this screenshot:

meta_key
  • Save

Now select “meta_key” and click on the “browse” icon. (Refer to above screenshot.)

On the next page, you will see all your meta_key values along with the number of rows used by them.

meta values
  • Save

For example, in above image, the meta_key “articleimg” has 2 rows. This means that that specific custom field is used in two images. Either I can find those two posts or I can simply delete that value from the database.

I will use the search field to find those two values and will delete them from my WordPress database.

Click on “Search”.

search
  • Save
On the next page, simply add the value of the meta_key you wish to search for.

For example, I will search for “articleimg”:

search-meta-key
  • Save

Hit the “Go” button and now simply select both values and delete them from your database.

delete-values
  • Save

This way you can get rid of all unwanted WordPress custom field values and keep your blog database optimized.

I would suggest that you only perform this task when you are confident enough to do so. It’s not rocket science, but one wrong click can cause you lots of hassle.

I also suggest you try the Advanced database cleaner plugin after this to clean up your WordPress database even further.

I hope you find this tutorial easy to understand. If you have any questions, feel free to ask via the comments section. If you liked this post, don’t forget to share on Facebook, Twitter, and Google Plus!

Was this helpful?

Thanks for your feedback!
  • Save
Authored By
A Blogger, Author and a speaker! Harsh Agrawal is recognized as a leader in digital marketing and FinTech space. Fountainhead of ShoutMeLoud, and a Speaker at ASW, Hero Mindmine, Inorbit, IBM, India blockchain summit. Also, an award-winning blogger.

8 thoughts on “How To Delete Custom Field Values From WordPress Database”

  1. Michael Aulia @CravingTech.com

    Thanks, Harsh. I plan to migrate my Platinum SEO plug-in fields/data etc to Thesis and clean up my tables. I’m backing up my database now and will use your guide to help me in cleaning. Cheers

  2. rakesh kumar

    Thanks harsh, it is great tip and i was initially tried a lots of themes before my own theme. So my blog has a lots of unused fields. so, i am going to use your tricks on my blog.

  3. Robin

    This is great at last I don’t need any plugin. Thanks

  4. mahendra

    Thanks Harsh
    I was looking for it since a long time. I noticed so many useless custom fielld in blog now I can kick out them

  5. HackTik

    Nice informative post. However, there is wordpress plugin named Plugin Garbage Collector is also available though I am not too sure if that plugin will serve the purpose outlined in this post. If you are going to do this yourself thru phpadmin then you can take the individual backups of the tables you will work on under Operations tab in phpadmin.

  6. Nihar

    Great tips.

    I did similar thing to delete unused tags. Unused tags will come up if we delete the posts due to some reason but the tags for those delete posts are not deleted..

    I think i have to come up with his post so that it helps others.

  7. Himanshu

    this something new. will try this for sure.

    1. Harsh Agrawal

      And it will help you to keep your WordPress database clean. Do try it but with extra precaution..Make sure you take a complete backup of your database before performing above action.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top