I am from Turkey and we have "şŞçÇğĞüÜöÖıİ" characters in our alphabet.

I want to use those characters in permalinks/slugs/usernames. I found temporary solution for permalinks/slugs with core-hacking. There is no other option for it except core-hacking seems. You can find solution here:


My problem is, user registration need a little fix after this one too. Fortunately there is filter i can use but couldnt handle it:

in wordpress includes/formatting.php :

function sanitize_user( $username, $strict = false ) {
 $raw_username = $username;
 $username = wp_strip_all_tags( $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 for max portability.
 if ( $strict )
  $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );

 $username = trim( $username );
 // Consolidate contiguous whitespace
 $username = preg_replace( '|\s+|', ' ', $username );

 return apply_filters( 'sanitize_user', $username, $raw_username, $strict );

This section of code is producing error:

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

Somehow i need to disable this section. But i am not sure how to do it.

  • Mighty good question, This problem is not only in Turkey. It is basically in every European language which is not English. Come to think about it - the problem exists for every language in the world that is not English ! ( Chinese, Japanese, Korean, Arab, Hebrew , Hindu ... basically 2/4 of the world population ... )
    – krembo99
    Dec 31, 2013 at 14:47
  • @krembo99 I created plugin for this purpose: wordpress.org/plugins/wordpress-turkce You can inspect and modify it for your language too Dec 31, 2013 at 15:49

1 Answer 1


Try this (not tested, I hope I am not short circuiting it into endless loop):

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.