get_comments()
get_comments( string|array $args = ” ) 检索注释列表。Retrieve …
get_comments( string|array $args = ” )
检索注释列表。
Retrieve a list of comments.
检索注释列表。
Retrieve a list of comments.
目录锚点:#说明#参数#返回#源码#笔记
说明(Description)
评论列表可以用于整个博客,也可以用于单个帖子。
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| $args | (string | array) | 可选 | 参数数组或字符串。有关接受的参数的信息,请参见WPúu Comment戋u Query::戋u construct()。 |
返回(Return)
(int|array)如果$count参数为true,则为注释列表或找到的注释数。
源码(Source)
/**
* Retrieve a list of comments.
*
* The comment list can be for the blog as a whole or for an individual post.
*
* @since 2.7.0
*
* @param string|array $args Optional. Array or string of arguments. See {@see WP_Comment_Query::parse_query()}
* for information on accepted arguments. Default empty.
* @return int|array List of comments or number of found comments if `$count` argument is true.
*/
function get_comments( $args = '' ) {
$query = new WP_Comment_Query;
return $query->query( $args );
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.7.0 | wp-includes/comment.php:241 | 11 | 1 function |
笔记(Notes)
显示帖子的评论计数
例子
显示最后5条未经批准的评论
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

还没有任何评论,赶紧来占个楼吧!