Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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