2011-10-09 54 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