WordPress 中文文档
Function Reference/get approved comments
From WordPress Chinese
目录 |
[编辑]
Description
Takes post ID and returns an array of objects that represent comments that have been submitted and approved.
[编辑]
Usage
<?php $comment_array = get_approved_comments($post_id); ?>
[编辑]
Example
In this example we will output a simple list of comment IDs and corresponding post IDs.
<?php
$postID = 1;
$comment_array = get_approved_comments(1);
foreach($comment_array as $comment){
echo $comment->comment_ID." => ".$comment->comment_post_ID."\n";
}
?>
[编辑]
