Skip to content

Instantly share code, notes, and snippets.

@qstudio
Created August 29, 2020 18:34
Show Gist options
  • Save qstudio/b85a935be8d255ad4529520ca5da116f to your computer and use it in GitHub Desktop.
Save qstudio/b85a935be8d255ad4529520ca5da116f to your computer and use it in GitHub Desktop.
// admin display key ##
\add_filter( 'q/eud/admin/display_key', [ get_class(), 'display_key' ], 10, 1 );
/**
* Filter keys in EUD plugin
*
* @since 2.0.0
*/
public static function display_key( $string = null )
{
#helper::log( 'string from filter: '.$string );
if ( is_null( $string ) ) {
return false;
}
// array of translations ##
$array = [
'example_usermeta_key' => 'Cleaner Title',
];
// check if $string exists as key in $array and if so, replace and return ##
if ( array_key_exists( $string, $array ) ) {
return $array[$string];
}
// kick it back ##
return $string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment