Skip to content

Instantly share code, notes, and snippets.

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 champsupertramp/f079bfde3226db4d8de787a45807dc98 to your computer and use it in GitHub Desktop.
Save champsupertramp/f079bfde3226db4d8de787a45807dc98 to your computer and use it in GitHub Desktop.
Pre and Post Title for custom Display name in UItimate Member
add_filter("um_user_display_name_filter",function( $value, $user_id ){
if( um_is_core_page('user') ){
preg_match_all('`"([^"]*)"`', $value, $results);
$pre_title = serialize( [ str_replace('"',"", $results[0][0] ) ] );
$post_title = serialize( [ str_replace('"',"", $results[0][1] ) ] );
$value = str_replace( $pre_title, str_replace('"',"", $results[0][0] ), $value );
$value = str_replace( $post_title, str_replace('"',"", $results[0][1] ), $value );
}
return $value;
},10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment