Support » Fixing WordPress » Locate the post slug function

  • Hello. I have this problem, my posts titles are in Greek language so the post slug is also in greek letters. Every time i change it manually ton english characters but i have this code that it will do it automatically. I do not know where to add it.
    Thank you.

    function title_slug( $title )
    $slug = $title;
    $bad = array( 'Š','Ž','š','ž','Ÿ','À','Á','Â','Ã','Ä','Å','Ç','È','É','Ê','Ë','Ì','Í','Î','Ï','Ñ',
    $good = array( 'S','Z','s','z','Y','A','A','A','A','A','A','C','E','E','E','E','I','I','I','I','N',
    // replace strange characters with alphanumeric equivalents
    $slug = str_replace( $bad, $good, $slug );
    $slug = trim($slug);
    // remove any duplicate whitespace, and ensure all characters are alphanumeric
    $bad_reg = array('/\s+/','/[^A-Za-z0-9\-]/');
    $good_reg = array('-','');
    $slug = preg_replace($bad_reg, $good_reg, $slug);
    // and lowercase
    $slug = strtolower($slug);
    return $slug;
  • The topic ‘Locate the post slug function’ is closed to new replies.