I set up a feature to enable the admin level user of my site to change a user's user_login in the wordpress users table. The admin can enter a new user name from the user's profile screen in the dashboard.
My code uses wpdb to update the user_login field for the user's row in the users table. However, wordpress also updates the user_nicename field, adding a "-2" to the end each time I update the user_login field.
ex. nicename before update
ex. nicename after 1st update
ex. nicename after 2nd update
My update set clause only sets a value for user_login not user_nicename.
Why does wordpress do this, and is there a way to prevent wordpress from updating the user_nicename field?