我想过滤评论类型,因为我使用WooThemes的Sensei,这个插件在评论中记录活动,Sensei评论与常规评论一起出现。
我在get_comments中放入了参数"type",但没有成功。
您可以使用wp_list_comments而不是get_comments阅读文档:http://codex.wordpress.org/Function_Reference/wp_list_comments
按类型"comment"筛选注释,默认为all:
<?php wp_list_comments( array( 'type' => 'comment', 'callback' => 'my_theme_comments', 'style' => 'ol' ) ); ?>
这对我来说是工作,希望这能帮助到别人。
如果您使用的是get_comments()
,那么您可以简单地使用$comment->comment_type
来只检查空类型(正常注释)