1

海。那么有人知道如何编写一个函数来清理通过所见即所得编辑器输入的特定类中的所有链接吗?我知道 wordpress 内置的 sanitize_title 功能,但我不知道如何引用这些链接(特定类中的链接)。非常感谢任何帮助。

4

1 回答 1

0

为什么不使用过滤器功能进行过滤the_content()

在您的 functions.php 文件中,包含过滤器挂钩:

add_filter ( 'the_content', 'your_sanitizer_function');

然后还在functions.php中编写过滤正常输出的清理函数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;

}
于 2011-03-13T20:21:54.307 回答