How can I allow Arabic usernames in WordPress

I want to let users put there username in Arabic when they register a new account, I tried a lot of methods put problem still unsolved

Topic characters username Wordpress

Category Web


By default WordPress limits non-Latin characters on usernames for security reasons but To allow users to use non-Latin letters in the username field, you can use the following code:

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 );
}

Add the above code to the 'functions.php' file in your WordPress theme's directory.


You can try WordPress Special Characters in Usernames plugin. This plugin enables usernames containing special characters (russian, cyrillic, arabic) on your WordPress blog.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.