Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Registering username with space can’t sign up

@pjtna

Participant

I am still having trouble with this and it is driving me nuts!
I have disabled the plugin “Restrict Usernames”, and have added this code to my functions.php file
`add_filter(‘validate_username’ , ‘custom_validate_username’, 10, 2);
function custom_validate_username($valid, $username ) {
if (preg_match(“/\s/”, $username)) {
// there are spaces
return $valid=false;
}
return $valid;
}`
And still, usernames with spaces are allowed through during registration.

Skip to toolbar