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. Often 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.customfieldsyntax

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!


Reply

Oren Yomtov

May 23, 20091:08 am

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

Reply

Peter

May 23, 200910:47 am

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.

Reply

Freelance Jobs

July 12, 200910:26 pm

This is what I looking for, thanks

Reply

Andrea

September 10, 200910:52 pm

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…

Reply

Car hire Belfast

November 19, 20099:59 am

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?

Reply

@rarepearldesign

January 25, 20102:31 pm

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

Reply

car hire munich

February 12, 201012:56 pm

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

Reply

Reino

February 17, 20104:07 pm

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

Reply

Sean Jordan

June 29, 201011:16 pm

After spending hours digging through the Plugin API reference and source code I was starting to lose hope. Then, one simple and obvious Google search, plus ten words of your blog later…

Wow. So obvious, too.

Comment on this post:

License: By commenting you are granting me a perpetual, non-exclusive license to reproduce, paraphrase, and display your words, name, and/or website on this domain. All comments subject to moderation, editing, or deletion at my discretion.

Important: Unfortunately, I'm unable to offer support via comments. However, feel free to hire me.

Entering code?

(optional)