Opened 7 months ago
Last modified 7 months ago
#22311 new defect (bug)
Cannot login when my loginname contains an "|" character
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Users | Version: | |
| Severity: | normal | Keywords: | close |
| Cc: |
Description
Hello,
Cannot login when my loginname contains an "|" character, for example:
Sent|el
or
P|ng|n
Can you fix his ? Other systems like phpBB3 have no problems with such usernames !
Change History (5)
comment:2
SergeyBiryukov — 7 months ago
- Component changed from Charset to Users
- Keywords reporter-feedback added
Hi,
I remember that i was able to create such account at one of WP blog. Maybe it was old version or so. Anyway, if this character is not allowed, it's even worse for WP: how people can create a nicknames with "clan" tags ? Like: sk|Okimi or similar ?
You could use Display Names for that. But due to how names are sanitized, I'm not surprised that login names have to be only a-z0-9 (we also use them as the default subdomain in Multisite)
comment:5
SergeyBiryukov — 7 months ago
- Keywords close added; reporter-feedback removed
"|" isn't a valid username character in WordPress. If you try to register as P|ng|n in 3.4.2, you'll get an error message:
ERROR: This username is invalid because it uses illegal characters. Please enter a valid username.
Current valid characters are listed in sanitize_user():
http://core.trac.wordpress.org/browser/tags/3.4.2/wp-includes/formatting.php#L881
You can, however, set your display name to whatever you like, including P|ng|n or sk|Okimi.
If you still need your users to be able to register with "|" character in usernames for some reason, sanitize_user filter can be used for that. See an example plugin in #18666.

You can't register a username with a | character at all. How did you even end up with that?