How to change a WordPress username

The other day I was working on one of my WordPress Multisite installations and being hosted on WPEngine the default admin username was the same as the site name. I’m not really a big fan of this myself so I decided to change it.

Oops, I guess you cannot change WordPress usernames from the front end. Make’s sense why this shouldn’t be changed. Imagine a world where everyone just changed their username whenever they wanted – chaos.

So for this you will need to login to your favorite MySQL manager. I’m a fan of Navicat, but Coda 2 also has a built in MySQL manager. These all works great but for WPEngine I get to use the old standby phpMyAdmin. Changing a WordPress username is a simple process really. Pretty much everything connecting users to posts and other data is using the user ID.

Within the MySQL database browse to your wp_users table, and find your current username in the user_login column. Simply change the user_login name to what you would like to login with from now on! I would recommend also updating the user_nicename column with the same exact username you just updated user_login with. This is just for the sake of consistency.

Disclaimer: You should not make this a regular practice and it is much easier just to choose a username you like from the very beginning. Do it right the first and and then you don’t have to fix it. Not only is this more efficient, but for those of us that are lazy it is much less work!

Bonus Round

As far as I am aware and in all the times I’ve done this, I have only run into one situation where things didn’t work right after this change. Just like the situation I am in right now that is updating the username of a network admin for your multisite installation. Open up your wp_sitemeta table in your database, and find the site_admins metakey. This meta_value is a serialized array of usernames. Find your old username in this array and change it to your new username. Be sure to change the number right before your username to the length of your new username. So if you changed your username from user to username, the number would be changed from 4 to 8. If you do not change this number the serialized array will not unserialize properly within WordPress and no one will have network admin rights.

Now I don’t know the exact reason why usernames were used instead of user ID’s but I’m sure the core developers know what they are doing 🙂