How to display user's nickname by default instead of username
I need to display the user's nickname by default after they are created in the DB, NOT the username.
I am creating a user with:
wp_create_user( $user_name, $random_password, $user_email );
updating the user nickname field directly after user creation:
update_user_meta($user_id, 'nickname', $user_nickName);
Now i need the "Display name publicly as" to be set to the nickname as default not the username.
My WP is automatically defaulting the users display name as the username. How do i put the selected value for the display name(Display name publicly as) as my nickname value programmatically?
Topic wp-create-user updates Wordpress
Category Web