Remove Spaces from the Username Field
-
Hi,
I’m trying to get this snippet working, but nothing happens. A user can still register with a username that contains spaces, e.g John Doe.
add_filter( 'validate_username', 'custom_validate_username', 10, 2 ); function custom_validate_username( $valid, $username ) { if ( preg_match( '/\s/', $username ) ) { return false; } return $valid; }
Cleared server Varnish cache.
Regards
Jack
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.