Home > Wordpress Development > wp_update_user and user_login

wp_update_user and user_login

The most frustrating part till now, the solution what i got, is writing a query which i didn’t liked. So i was searching more of a native wordpress function. Wen i was using wp_update_user with its arguments & i was adding user_login to update my username. Everything was fine but when i tried updating the user_login it used to be the same the day i created the user. So then after looking all over unfortunately there is only one way to do it and which is :

      $wpdb->query("UPDATE $wpdb->users SET user_login = '[new_user]' WHERE ID = '[user_id]'");

WordPress strictly discourage to update username/user_login.

Categories: Wordpress Development
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: