Classiera - Classified Ads WordPress Theme

Allow Arabic username in classiera

If you want to allow your user's to signup with arabic username, Then please code this code and paste is your child theme functions.php file.

function classiera_allow_arabic_username($username, $raw_username, $strict) {
    $username = wp_strip_all_tags( $raw_username );
    $username = remove_accents( $username );
    $username = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])|', '', $username );
    $username = preg_replace( '/&.+?;/', '', $username ); // Kill entities
    // If strict, reduce to ASCII and Arabic characters for max portability.
    if ( $strict )
    $username = preg_replace( '|[^a-z\p{Arabic}0-9 _.\-@]|iu', '', $username );
    $username = trim( $username );
    // Consolidate contiguous whitespace
    $username = preg_replace( '|\s+|', ' ', $username );
    return $username;
}
add_filter('sanitize_user', 'classiera_allow_arabic_username', 10, 3);