1

How do I change a username? My username is showing up in search engines as an author but it's a product and services based site (using only pages) for a client. If I can't remove the author pages I need to change my username.

It looks like you can change your username if you are on wordpress.com so that means it might be possible but this is a personal WP install.

2 Answers 2

1

Answer originally posted on another question which was more "why we can't" instead of "how": https://web.archive.org/web/20210408084000/https://wordpress.stackexchange.com/questions/135304/why-cant-i-update-username-through-wordpress-api/386265

Here is the solution I used to change the username properly (based on https://www.wpbeginner.com/wp-tutorials/how-to-change-your-wordpress-username/ which had missing information):

I was able to change the username simply with SQL using update wp_users set user_login = "old_username", user_nicename = "new_username" where id = user_id; (replace old_username, new_username and user_id with your values).

The old username will still be present in some other tables, for example "old_username changed the comment status to approved" in table wp_commentmeta, column meta_value but it looks like it is not necessary to change it.

In addition I did a permalink redirect in Apache with the rule RedirectPermanent /blog/author/old_username /blog/author/new_username to avoid 404 Not Found errors since the link was indexed by search engines.

I also updated my username for the comments I left on my website, using the comments menu in WordPress (not necessary but just to be consistent and avoid confusion for visitors).

There is another configuration to change if you are using a multisite installation, to stay a Network Admin. This can be done by changing the line with the column meta_key that has the value site_admins (Add Wordpress MU Network Admin via Database), for example with an SQL statement like update wp_sitemeta set meta_value = "a:1:{i:0;s:4:\"bapt\";}" where meta_id = 8; (note that the value 4 should match the length of the username, bapt in this case and the ID 8 can be different in your case). Note: with wp-cli search-replace function, you don't need to worry about the length: Why can't I update username through Wordpress API?

Also if your website is open to username registration, for example with BuddyPress, I think another user will be able to create a username that is an old one of someone else and you could have issues with the Apache redirect (you would need to disable the redirect or forbid registration of old usernames in this case).

0

It looks like you can change it by installing a plugin called, Username Changer and then changing it on your profile page.

It also looks like it's possible to manually go into the database, open the wp_users table and change it by hand. I won't post the instructions for modifying a mySQL database since there are plenty online or there is an article that goes into it here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.