Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WordPress filter to replace the default "_" (underscore) with "-" (hyphen) in protected custom fields for debugging purposes
<?php
/**
* Replace the default "_" (underscore) with "-" (hyphen) in protected custom fields for debugging purposes
*
* @param bool $protected The default value
* @param string $meta_key The meta key
* @return bool True for meta keys starting with "-" (hyphen), false otherwise
*/
function unprotected_meta( $protected, $meta_key ) {
$protected = ( '-' == $meta_key[0] );
return $protected;
}
add_filter( 'is_protected_meta', 'unprotected_meta', 10, 2 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment