开发者

Sanitize inline links in wordpress?

开发者 https://www.devze.com 2023-02-04 09:09 出处:网络
Hy. So would anybody know how to write a function that would sanitize all links in a specific class that are entered through WYSISW开发者_StackOverflowYG editor?

Hy. So would anybody know how to write a function that would sanitize all links in a specific class that are entered through WYSISW开发者_StackOverflowYG editor? I know about the wordpress in-built sanitize_title function, but I don't know how I could refer to those links(links in a specific class). Any help much appreciated.


Why don't you use a filter function to filter the_content()?

In your functions.php file, include the filter hook:

add_filter ( 'the_content', 'your_sanitizer_function');

Then also in functions.php write the sanitizing function that will filter the normal output of the_content():

function your_sanitizer_function($content){

    /* use some php here to change your content as you see fit...
        for example, $content = str_replace('foo', 'bar', $content);
     */

    return $content;

}
0

精彩评论

暂无评论...
验证码 换一张
取 消