上記の関数を使用して、投稿のタイトルから URL スラッグを作成しています。問題は、ç
文字が に変換されていないことc
です。実際には関数によってオーバーライドされています。
投稿タイトルの例: Coração de Pelúcia
生成されたナメクジ: coraao-de-pelucia
この関数を修正して、次のようなスラッグを生成するにはどうすればよいですか: coracao-de-pelucia
function generate_seo_link($input,$replace = '-',$remove_words = true,$words_array = array())
{
//make it lowercase, remove punctuation, remove multiple/leading/ending spaces
$return = trim(ereg_replace(' +',' ',preg_replace('/[^a-zA-Z0-9\s]/','',strtolower($input))));
//remove words, if not helpful to seo
//i like my defaults list in remove_words(), so I wont pass that array
if($remove_words) { $return = remove_words($return,$replace,$words_array); }
//convert the spaces to whatever the user wants
//usually a dash or underscore..
//...then return the value.
return str_replace(' ',$replace,$return);
}