Tag Archives: customise wordpress usernames

[SOLVED] Allow WordPress to accept plus (+) sign in usernames

It was revealed to me recently that a wordpress system which programatically creates user accounts via an external api, where we only allow email addresses as the username, anyone submitting a + sign in the username, the plus sign (+) was being stripped out.

For Example:
joe.bloggs+1@gmail.com was becoming joe.bloggs1@gmail.com (wordpress was stripping out the + sign).

So after a bit of sifting around the interwebs, I came across a plugin which allows foreign characters like Arabic and Cyrillic. So not exactly what I was looking for but I figured I could use some of the code.

Drop the following into your functions.php so that it overrides the filtering of the usernames when sanitize_user is called from WordPress core and edit the $allowed_symbols to permit the characters you would like in the new username when its created.