Support Arabic Username in WordPress registration and login
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
function aau_sanitize_user($username, $raw_username, $strict) { $username = wp_strip_all_tags( $raw_username ); $username = remove_accents( $username ); // Kill octets $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', 'aau_sanitize_user', 10, 3); |

you can download also this plugin