Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Show Hidden Custom Fields in WordPress

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Show Hidden Custom Fields in WordPress

Often when a plugin needs to utilize custom fields and work in the background, the authors make them hidden by adding an underscore to the name. This allows their plugin to work smoothly without any interruption. But if you are a developer trying to debug something or just a curious learner, then you probably want to know everything that is being added by the plugins. In this article, we will show you how you can display hidden custom fields in WordPress.

All you need to do is open your theme’s functions.php file and drop this code in there:

add_action( 'admin_head', 'showhiddencustomfields' );

function showhiddencustomfields() {
	echo "<style type='text/css'>#postcustom .hidden { display: table-row; }</style>
";
}

However by pasting the code, you are limited to the specific theme. If you wanted to switch the theme, then you would have to add this code all over again. So you can simply create a PHP file, and save the code in there and upload it as a plugin.

Or you can simply use Show Hidden Custom Fields

All credits for this amazing trick goes to Viper007Bond.

This post is provided by the color flyer printing experts, Next Day Flyers.

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Comments

  1. Rodolfo says:

    It should be:

    add_action( ‘admin_head-post.php’, ‘showhiddencustomfields’ );
    add_action( ‘admin_head-post-new.php’, ‘showhiddencustomfields’ );

    As we don’t want the styles printing all over the admin ;)

  2. Pranjal says:

    Okay but that code doesn’t shows custom fields on custom post types? can you please tell me how to do so ?

    • Editorial Staff says:

      This should show custom fields on all post types. It’s simply adding a CSS code in the admin. Do you have custom fields registered for the post type?

  3. easyP says:

    Love your tips

    Short, sharp and to the point.

    I’m no PHP expert but you guys make learning so much easier.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.