How to change your WordPress login username
People with administrator privileges on your WordPress website should have user accounts that allow to easily identify them by their login username. Learn how you can change the login usernames in WordPress.
The WordPress administration backend does not allow to change the login username of a user account. The login username can only be set initially when creating a new user account.
Here are two approaches using WP-CLI:
Change WordPress username using a SQL query
wp db query "UPDATE wp_users SET user_login = 'firstname.lastname' WHERE user_email = 'email@example.com';"
This updates the login username field of the user identified by their email address to the new value.
Change WordPress username using Search & Replace
wp search-replace wrongusername firstname.lastname wp_users --include-columns=user_login
This updates the login username string everywhere it is found in the database with the new value - but we are limiting the update to the users table.
Change WordPress username using a plugin
Installing a plugin for an operation that is only done once is not recommended, because every installed plugin has an impact on the website performance. Even after uninstalling the plugin, in case it does not implement the necessary uninstall functions – which almost all authors of WordPress plugins happen to forget.
If you do not have another choice, then you can use the Easy Username Updater plugin.
Why can I not change a username in the WordPress administration?
The feature to allow site administrators to change usernames has been requested 11 years ago already and was re-opened several times over time.
It was rejected by the WordPress Core developers, because it can break pages that are listing posts by author, if you have such listing pages enabled.
In my opinion, the reasoning of WordPress Core developers is a bit far-fetched and inconsistent, because the same applies to posts, categories, and other content types. And yet it is possible to change their names/slugs – and thus, break their URLs.
Plugins like Yoast SEO Premium are proactively catching these cases and automatically generating redirects from the old URL to the new URL.
In our case, most of our WordPress sites have author pages listing posts by author disabled using the Yoast SEO plugin. In addition, in some cases, the user accounts being renamed belong to developers who do not have any published content in the first place.
It is easy to change the login username in WordPress on the command line. However, it requires to know how to use a terminal and usually also SSH.
There are most certainly plugins for this, too. But I would not recommend to install them as renaming usernames is usually just a one-time operation and every installed plugin tends to leave traces of itself behind, diminishing the site's performance.
Ideally, someone manages to convince WordPress Core developers to re-open and add the long-standing feature request in the admin user interface, so that every WordPress site administrator can rename login usernames whenever the need arises.