Retrieves a list of comments.
Description
The comment list can be for the blog as a whole or for an individual post.
Parameters
$argsstring|arrayoptional- Array or string of arguments. See WP_Comment_Query::__construct() for information on accepted arguments.
Default:
''
Source
function get_comments( $args = '' ) { $query = new WP_Comment_Query(); return $query->query( $args ); } Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |
Show comment counts of a post
Get comments from last 4 weeks
Example
Show last 5 unapproved comments
Show comment counts of a user
Show comments of a user
Get all comments of two post types:
Get child comment of parent comment
or you can use get_children()