As the title says. When users register with white spaces in their usernames, if you try to go to their author page, you get a 404 error.
Is there a way to fix the redirect? or should I add a filter to prevent the use of white spaces in usernames? The site is new, so it wouldn’t be hard to just change the one author with the issue.
I would think WordPress would prevent people from having white spaces in their username.
Spaces are not allowed in URLs, so WordPress uses the
user_nicename
for those links. The usernice_name
is “A string that contains a URL-friendly name for the user. The default is the user’s username.”. That is a transformed user name such that it is all lowercase with spaces replaced by dashes. I did not look up what other transformations are probably occurring.Whatever is creating those links is doing it wrong. Without seeing the code that creates the links, it is hard to say more.