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.
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
Okay but that code doesn’t shows custom fields on custom post types? can you please tell me how to do so ?
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?
Love your tips
Short, sharp and to the point.
I’m no PHP expert but you guys make learning so much easier.