OAuth / OpenID Connect

How to allow chinese (or any latin) keywords in WP username?

316 views September 7, 2021 saurabhshingade 3

To allow the special characters in the WordPress Username, add the below lines in the functions.php file of your theme.

add_filter(‘sanitize_user’, ‘non_strict_login’, 10, 3);
function non_strict_login( $username, $raw_username, $strict ) {
     if( !$strict )
        return $username;
     return sanitize_user(stripslashes($raw_username), false);
}

Was this helpful?