有条件的“ the_content”过滤器wordpress

里士

我在functions.php中为“ the_content”添加了一个过滤器

add_filter ('the_content', 'testFilter');
function testFilter($content) {
  if(is_single()) {
    $content.="Append content";
  }
  return $content;
} 

现在在我的content-post.php中。我有以下几行:

the_content(__('Test;', 'tag') );

如何将testFilter排除在content-post.php页面上?

Vrajesh

remove_filter函数上方添加函数the_content(__('Test;','tag'))

remove_filter( 'the_content', 'testFilter',11 );
the_content(__('Test;', 'tag') );

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章