3

I was opened this idea 7 months ago:
http://wordpress.org/extend/ideas/topic/non-latin-characters-need-love
Still i couldnt find a solution for it.

Simply what i want?
Want to use "şŞ İı Ğğ Üü Öö çÇ" turkish characters in permalinks / slugs.

3

1 Answer 1

1

You must go about the language functions-interface. See my example for german users: http://wordpress-buch.bueltge.de/wp-content/uploads/2010/05/de_DE.phps We must also build differences on the permalinks for aour charachters in our language

    /* define it global */
    $umlaut_chars['in']    = array( chr(196), chr(228), chr(214), chr(246), chr(220), chr(252), chr(223) );
    $umlaut_chars['ecto']  = array( 'Ä', 'ä', 'Ö', 'ö', 'Ü', 'ü', 'ß' );
    $umlaut_chars['html']  = array( 'Ä', 'ä', 'Ö', 'ö', 'Ü', 'ü', 'ß' );
    $umlaut_chars['feed']  = array( 'Ä', 'ä', 'Ö', 'ö', 'Ü', 'ü', 'ß' );
    $umlaut_chars['utf8']  = array( utf8_encode( 'Ä' ), utf8_encode( 'ä' ), utf8_encode( 'Ö' ), utf8_encode( 'ö' ),utf8_encode( 'Ü' ), utf8_encode( 'ü' ), utf8_encode( 'ß' ) );
    $umlaut_chars['perma'] = array( 'Ae', 'ae', 'Oe', 'oe', 'Ue', 'ue', 'ss' );

    /* sanitizes the titles to get qualified german permalinks with  correct transliteration */
    function de_DE_umlaut_permalinks($title) {
        global $umlaut_chars;

        if ( seems_utf8($title) ) {
            $invalid_latin_chars = array( chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe', chr(197).chr(160) => 'S', chr(197).chr(189) => 'Z', chr(197).chr(161) => 's', chr(197).chr(190) => 'z', chr(226).chr(130).chr(172) => 'E' );
            $title = utf8_decode( strtr($title, $invalid_latin_chars) );
        }

        $title = str_replace($umlaut_chars['ecto'], $umlaut_chars['perma'], $title );
        $title = str_replace($umlaut_chars['in'], $umlaut_chars['perma'], $title );
        $title = str_replace($umlaut_chars['html'], $umlaut_chars['perma'], $title );
        $title = sanitize_title_with_dashes($title);

        return $title;
    }
add_filter( 'sanitize_title', 'de_DE_umlaut_permalinks' );
6

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.