Non-Latin Characters in permalinks

by Ünsal Korkmaz   Last Updated May 15, 2019 22:08 PM

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.



Answers 2


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' );
bueltge
bueltge
October 26, 2010 06:42 AM

Is there any update to this or an edit to the core already?

@Ünsal: Does your plugin work with the latest version of WP? Will it lose its function if you update WP to a newer version?

Which solution does your plugin use? Does it use any of these 2 topics: Wordpress slug issue with non-latin characters Slug Formatting : Acceptable Characters?

theforamyst
theforamyst
May 15, 2019 21:21 PM

Related Questions


Updated May 02, 2017 20:08 PM

Updated December 30, 2017 17:08 PM

Updated March 24, 2018 13:08 PM

Updated August 23, 2018 07:08 AM

Updated October 15, 2018 17:08 PM