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');
the above fixed the issue for me. another way is below.
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, '-');
}
FINALLY FIXED