Need a WordPress Expert?

Hire me!

May22

How to Hide Your Plugin’s Custom Fields

by John Kolbert | Posted in: WordPress



Many plugins use custom fields to store data about individual posts. When a plugin adds a custom fields, its key and value (or name and value) are listed in the Custom Fields meta box. For instance, a syntax hilighting plugin may set a custom field syntax_enabled on posts that use the syntax highlighting CSS.customfieldsyntaxOften the user doesn’t need to see this information and it can leed to needless confusion. Unless the user needs to edit these custm field values there’s really no need to have them listed here.

How to Hide Custom Fields

Custom fields can be hidden from the Custom Fields meta box quite easily. Typically custom fields are added by using the following code:


add_post_meta($id, 'name', 'value');

To hide your custom field from user view, simply start the name of your custom field with and underscore (“_”). So create your custom field like this:

add_post_meta($id, '_name', 'value');

Your custom field is now hidden!

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

10 Comments

  1. Oren Yomtov said:

    If you need to change lots of custom fields you can use my plugin to do it.

    on May 23, 2009 at 1:08 am Reply

  2. Peter said:

    I couldn’t agree more John – more plugins (I’m looking at you, all in one seo pack) should absolutely take advantage of this. Having the information displayed in 2 places only causes confusion.

    on May 23, 2009 at 10:47 am Reply

  3. Freelance Jobs said:

    This is what I looking for, thanks

    on July 12, 2009 at 10:26 pm Reply

  4. Andrea said:

    i am actually just starting to learn wordpress, i know somebody who just got into using wordpress, he's actually a programmer that recently started with wordpress… he told me how great it is and that i can do it too as it's fairly easy to use… that's why i'm going around looking for things to learn.. thanks for this, i'm positive we'll benefit from this…

    on September 10, 2009 at 10:52 pm Reply

  5. Car hire Belfast said:

    I have worked with Joomla. Could anyone tell me which tool is better – Wordpress or Joomla? I like Joomla and it is quite easy to work with Joomla. Wordpress looks a little bit more complicated, isn't it?

    on November 19, 2009 at 9:59 am Reply

  6. @rarepearldesign said:

    thanks for this information, this cleaned up my ui quite a bit!

    on January 25, 2010 at 2:31 pm Reply

  7. car hire munich said:

    finally I have found what I am looking for! thanx!

    on February 12, 2010 at 12:56 pm Reply

  8. Reino said:

    But how about field that are allready submitted, is there a way to hide them using the underscore method :) ?

    on February 17, 2010 at 4:07 pm Reply


RSS feed for comments on this post.

Trackbacks on this post

Links to this post will be listed here. You an add your own by linking to the TrackBack URL

  1. WordPress tip: Create invisible custom fields | Fresh News - Blog Design, Wordpress, Blogger, and Web Development

    [...] to my friend John Kolbert for the [...]

Leave a comment



By pressing submit you are granting me a perpetual, non-exclusive licence to reproduce, paraphrase, and display your words, name, and/or website on this domain. All comments subject to moderation at my discretion.