Wordpress - Why can't I update username through Wordpress API?

Looking on Trac I found a ticket that discusses exactly this issue: Administrator should be able to change usernames

This is what it all boils down to:

Changing usernames could break permalinks

To prevent this a lot more than just changing the username in the DB would need to be done. E.g. redirection from old usernames.

Caching Issues

I quote from the aforementioned Ticket:

"One problem you could get, if you do this using the db while using memcached, is the the old value remains in the store until memory runs out."

Denis-de-Bernardy

TL;DR

It may cause various problems and therefore is intentionally difficult to do. In case you think of this differently fell free to join the discussion in the corresponding ticket.


There is a note on the wp_udate_user function codex page: http://codex.wordpress.org/Function_Reference/wp_update_user. And that is:

Please note that we cannot change the usernames through this function, in fact the usernames cannot be changed from the admin dashboard as well since WordPress does not allow the usernames to be updated.

So you can't change the username using wordpress built in functions because Wordpress developers think it's not a good practice. There really are not any other explinations to this besides the one listed in the Note.