admin管理员组文章数量:1335825
Hello please I want to search and replace word after /check/
and make it to be permalink sanitized.
i.e
,ido Song/ => with /
,i'do1/ => /
(i'do)/ => /
I want to achieve this using sanitize_title() or sanitize_title_with_dashes() function.
here is my word replacer. I dont know where i am getting it wrong.
function emailleftappend($content){
$findleft = '/check\/(?<=\/)([A-Za-z]+?)(?=\/">)/m';
$replaceleft = sanitize_title_with_dashes($findleft);
// $content = preg_replace($findleft, $replaceleft, $content);
return preg_replace($findleft, $replaceleft, $content);
}
add_filter('the_content', 'emailleftappend');
Gurus in the house please help me out, i am not good in wp.
本文标签: functionssearch and replace using regex
版权声明:本文标题:functions - search and replace using regex 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742400284a2467749.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论