Wordpress 仅在单发邮件上启用wpautop筛选器
我已将以下内容添加到我的wordpress themes functions.php文件中:Wordpress 仅在单发邮件上启用wpautop筛选器,wordpress,function,wordpress-theming,Wordpress,Function,Wordpress Theming,我已将以下内容添加到我的wordpress themes functions.php文件中: //disable wpautop filter remove_filter ('the_content', 'wpautop'); remove_filter ('the_excerpt', 'wpautop'); 它去掉了所有讨厌的标签wordpress把所有东西都包装起来 然而,我想知道是否有一种方法可以只在非单一页面(例如:主页、档案、类别、作者等)上实现这一点。我想禁用wpautop的一切,
//disable wpautop filter
remove_filter ('the_content', 'wpautop');
remove_filter ('the_excerpt', 'wpautop');
它去掉了所有讨厌的标签wordpress把所有东西都包装起来
然而,我想知道是否有一种方法可以只在非单一页面(例如:主页、档案、类别、作者等)上实现这一点。我想禁用wpautop的一切,除了单一的职位和网页。。。可能吗
function get_rid_of_wpautop(){
if(!is_singular()){
remove_filter ('the_content', 'wpautop');
remove_filter ('the_excerpt', 'wpautop');
}
}
add_action( 'template_redirect', 'get_rid_of_wpautop' );
将其添加到主题的functions.php
文件中
将其添加到主题的functions.php
文件中