作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在一页中插入多个页面(使用 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/
我是一名优秀的程序员,十分优秀!