As a WordPress developer with years of experience troubleshooting plugins, I've often needed to inspect hidden custom fields. Plugins frequently prefix these fields with an underscore (e.g., _field_name) to keep them out of sight in the admin interface, ensuring seamless operation. But for debugging or deeper understanding, revealing them is essential. Here's a reliable method I've used countless times.
Add this code snippet to your active theme's functions.php file:
add_action('admin_head', 'show_hidden_custom_fields');
function show_hidden_custom_fields() {
echo '<style>#postcustom .hidden { display: table-row !important; }</style>';
}This CSS override forces hidden rows to display in the Custom Fields metabox. Note that it's theme-specific—switching themes requires re-adding it.
For a more portable solution, save the code in a new PHP file (e.g., show-hidden-fields.php), wrap it in plugin headers, and activate it as a custom plugin:
<?php
/*
Plugin Name: Show Hidden Custom Fields
Description: Reveals underscore-prefixed custom fields.
*/
add_action('admin_head', 'show_hidden_custom_fields');
function show_hidden_custom_fields() {
echo '<style>#postcustom .hidden { display: table-row !important; }</style>';
}
?>Alternatively, install the 'Show Hidden Custom Fields' plugin for a no-code option.
Full credit for this technique goes to the esteemed WordPress contributor Viper007Bond.