I'm just wondering about usernames... Why isn't is possible to change this through Wordpress API? (I understand why a user in the admin dashboard can't change username(s) but that isn't really same thing!?)
Code below does just ignore the user_login - setting.
$pupil_obj= get_post($postid_pupil);
$user_login = $pupil_obj->post_name;
$user_nicename = $pupil_obj->post_name;
$user_args = array(
'ID' => $current_user->ID,
'user_email' => $email,
'user_login' => $user_login,
'user_nicename' => $user_nicename
);
wp_update_user( $user_args ) ;
I could update the username to the database directly through $wpdb
. This makes no sense to me. Can someone explain?
wp search-replace --regex '\bOLD_USERNAME\b' 'NEW_USERNAME' --log=- --dry-run