There exist a plugin for wordpress to enable usernames containing special characters (Russian, Cyrillic, Arabic …). Unfornetly this plugin didn't work for me. I have even a look at this solution but didn't work too. Here is the function defined to register users in the theme I'm using (QAEngine theme)

public function register(){
    $param = $_REQUEST['content'];
    $args  = array(
        'user_email'    => $param['email'],
        'user_pass'     => $param['password'],
        'user_login'    => $param['username'],
        'display_name'  => isset($param['display_name']) ? $param['display_name'] : $param['username']
    $captcha = isset($_REQUEST['captcha']) ? $_REQUEST['captcha'] : '';
    // validate here, later
    try {

        //verify captcha
        ae_verify_captcha($captcha, __('Please enter a valid captcha!', ET_DOMAIN));

        $role = apply_filters('qa_custom_role', 'author' );
        do_action ('je_before_user_register', $args);

        // apply register & log the user in
        $auto_sign  = ae_get_option( 'user_confirm' ) ? false : true;
        $user_id    = et_register( $args , $role, $auto_sign );

        if ( is_wp_error($user_id) ){
            throw new Exception($user_id->get_error_message() , 401);

        $data     = get_userdata( $user_id );
        $userdata = QA_Member::convert($data);
        // generate new nonces
        $msg = ae_get_option( 'user_confirm' ) ? __('You have registered an account successfully but are not able to join the discussions yet. Please confirm your email address first.', ET_DOMAIN) : __('You are registered and logged in successfully.', ET_DOMAIN) ;
        $response = array(
            'success'       => true,
            'code'          => 200,
            'msg'           => $msg,
            'data'          => $userdata,
            'redirect'      => apply_filters( 'qa_filter_redirect_link_after_register', home_url() )

    } catch (Exception $e) {
        $response = array(
            'success' => false,
            'code'    => $e->getCode(),
            'msg'     => $e->getMessage()
    wp_send_json( $response );

Here you could find a complete php file in which this function is declared.

Any recommendation for how to allow non-latin characters in usernames?


After looking for other similar questions, I must clarify that I'm working on a multisite and I found that some given solutions are about hooking wpmu_validate_user_signup filter in multisite case (Here an example). So I add the given code to my function.php file but this didn't solve the problem even if I keep the code for hooking the sanitize_user filter.

However, when I made changes in the wordpress core I mean in /wp-includes/ms-functions.php#L452.

if ( $user_name != $orig_username || preg_match( '/[^a-z0-9]/', $user_name ) ) {


if ( $user_name != $orig_username || preg_match( '/^[\p{Arabic}a-z0-9 _.\-@]/', $user_name ) ) {

and in /wp-includes/formatting.php#L2095 from

$username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );


$username = preg_replace( '|^[\p{Arabic}a-z0-9 _.\-@]|i', '', $username );

This enables me to register new users with non-latin characters in the backend. However, I can't log in with the new registered usernames in non-latin characters, either register users with no-latin characters from the frontend of my multisite.

  • Possible duplicate of Allowing non-latin characters in registration – Jacob Peattie Mar 15 '19 at 2:15
  • @JacobPeattie I updated my question. I have even take a look at the refered question but didn,t work for me. Seems the problem is in the way how the register function is defined. – Hamed Mar 15 '19 at 8:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.