Skip to content

Instantly share code, notes, and snippets.

@qstudio
Last active August 29, 2020 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qstudio/cf49314e5cb4521b86cca72ae51c992d to your computer and use it in GitHub Desktop.
Save qstudio/cf49314e5cb4521b86cca72ae51c992d to your computer and use it in GitHub Desktop.
// Add the filter ##
\add_filter( 'q/eud/export/field', [ get_class(), 'field_key' ], 10, 1 );
/**
* Filter keys in EUD plugin
*
* @since 2.0.0
*/
public static function field_key( $string = null )
{
#error_log( 'string from EUD filter: '.$string );
if ( is_null( $string ) ) {
return false;
}
// rename specific fields ##
switch( $string ) {
// usermeta field key ##
case 'example_usermeta_key' :
// string replacement to show in export ##
$string = 'Cleaner Title' ;
break ;
}
// apply optional format to all strings ##
$string = str_replace( "_", " ", ucwords( $string ) );
// kick it back ##
return $string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment