user_nicename has the same value with user_login. I want to change user_nicename value only by using code snippet into functions.php or wp-config.php. Is it possible without using phpmyadmin or any plugin?
1 Answer
Yes, you can use wp_update_user()
:
wp_update_user( array(
'ID' => 123,
'user_nicename' => 'value'
) );
Just replace 123
with the proper user ID, and value
with the preferred user_nicename
value.
The function also enables you to change the value of other fields in the WordPress users table (wp_users
).