function emailleftappend($content){
$content = preg_replace_callback(\'/(?<=get\\/)(.*?)-(.*?)(?=\\/">)/\', function ($m) {
return sanitize_title($m[1]). \'-\'. sanitize_title($m[2]); }, $content);
return $content;
}
add_filter(\'the_content\', \'emailleftappend\');
以上为我解决了这个问题。另一种方法如下。
function emailleftappend($content){
$content = preg_replace_callback(\'/(?<=get\\/)(.*?)-(.*?)(?=\\/">)/\', function ($m) {
return slug($m[1]). \'-\'. slug($m[2]); }, $content);
return $content;
}
add_filter(\'the_content\', \'emailleftappend\');
function slug($z){
$z = strtolower($z);
$z = preg_replace(\'/[^a-z0-9 -]+/\', \'\', $z);
$z = str_replace(\' \', \'-\', $z);
return trim($z, \'-\');
}
最终修复