Never mind, turns out I’m not so bright. I misunderstood the filter as providing a list of characters it ALLOWED rather than DISALLOWED.
For anyone in the future who can benefit from this, here is the working code.
function my_custom_username_validation_regex( $default_regex ) {
// This regex disallows any character that is not alphanumeric.
$non_alphanumeric_regex = '/[^a-z0-9]/i';
return $non_alphanumeric_regex;
}
add_filter( 'um_validation_safe_username_regex', 'my_custom_username_validation_regex', 10, 1 );
-
This reply was modified 1 year, 5 months ago by rando390.