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