Last active
February 21, 2024 11:01
-
-
Save eduardozulian/4354337 to your computer and use it in GitHub Desktop.
WordPress filter to replace the default "_" (underscore) with "-" (hyphen) in protected custom fields for debugging purposes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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