Set Nickname as First Name + Last Name
-
Hello I need help. If user register on website his Nickname is set to username as you can see here ( https://prnt.sc/jlT6K_FyD6Yv ). How can I set up nickname to “firstname + lastname” ?
I tried this code but after user registration if I check his profile there is still username (number)
/** ADD DISPLAY NAME = FIRSTNAME + LAST NAME **/ add_action('user_registration_after_register_user_action','my_function'); function my_function($user_id){ //do your stuff $first_name = get_user_meta($user_id, 'first_name', true); $last_name = get_user_meta($user_id, 'last_name', true); $user_nickname = $first_name.' '.$last_name; update_user_meta( $user_id, 'nickname', $user_nickname ); }
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Set Nickname as First Name + Last Name’ is closed to new replies.