- This topic has 1 reply, 2 voices, and was last updated 5 years, 4 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
WordPress Membership Plugin
Simple Membership Plugin › Forums › Simple Membership Plugin › Change the wordpress user display name
Tagged: change display name, create users, user, users
Hello, I’m trying to change the wordpress user display name when a simple membership user is created.
I’m trying this following code :
function change_display_name_user_register ( $user_id ) {
// get the user meta data
$user_info_other = get_user_meta( $user_id );
// pick our default display name
$display_publicly_as = $user_info_other["first_name"][0] . " " . $user_info_other["last_name"][0];
// update the display name
wp_update_user( array ('ID' => $user_id, 'display_name' => $display_publicly_as));
}
add_action( 'user_register', 'change_display_name_user_register', 10, 1 );
this code seems to work but it does not change anything.
what’s wrong with this, is there an other “hook” to use to redefine wordpress display_name ?
Is someone has already dealt with this case ?
Thanks in advance for your help.
Hi, for code development questions, please create a paid support ticket.
Thank you