写一个循环并浏览每个评论是我可以提供给你的选择。看看这个例子:
function get_comment_authors($post_ID){
// Get every comment on this post
$args = array(
\'post_id\' => $post_ID
);
$comment_objects = get_comments( $args );
// Define an empty array to store the comments
$author_array = array();
// Run a loop through every comment object
foreach ( $comment_objects as $comment ) {
// Get the comment\'s author
$author_array[] = $comment->comment_author;
}
// Return the authors as an array
return $author_array;
}
所以,
get_comment_authors(123);
将返回ID为123的所有在帖子上留言的作者。