2011-10-09 53 views
2

我可以使用get_comments获得wordpress评论列表。 例如:获取没有引用的wordpress评论?

$comments = get_comments('status=approve&number=10'); 

它也返回引用通告。是否有可能只获得人的意见(没有引用等)?谢谢。

回答

1

我相信:

$comments = get_comments('status=approve&number=10&type=comment'); 

退房的documentation reference,虽然在get_comments()的情况下,它不是特别有帮助。

此外,另一个可能的语法,我觉得更清洁,是上述语法相当于:

$args = array(
    'status' => 'approve', 
    'number' => 10, 
    'type' => 'comment', 
); 
$comments = get_comments($args); 

$args数组定义得到的意见,当你想的约束。

+0

非常感谢,这非常有帮助。 – user966585