gpt4 book ai didi

WordPress - 仅在一页上应用remove_filter

转载 作者:行者123 更新时间:2023-12-03 07:26:04 26 4
gpt4 key购买 nike

我在一页中插入多个页面(使用 showmultiplepages 插件),并且一页包含一个 php 文件(使用 exec-php)。我只想禁用此包含页面的过滤器。如果我添加

remove_filter( 'the_content', 'wpautop' );

对于我包含的页面,此页面之后的任何页面也不会有过滤器。

是否有一些像“the_page”这样的标签,以便只有页面没有过滤器?

感谢您的帮助。

最佳答案

我知道这是一个老问题,但我想我会为那些希望在更一般意义上做到这一点的人(例如,不与插件输出结合使用)插话,并说你也可以将其添加到你的functions.php 文件:

add_filter('the_content', 'specific_no_wpautop', 9);
function specific_no_wpautop($content) {
if (is_page('YOUR PAGE')) { // or whatever other condition you like
remove_filter( 'the_content', 'wpautop' );
return $content;
} else {
return $content;
}
}

关于WordPress - 仅在一页上应用remove_filter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6285812/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com