get_comments()
Retrieve a list of comments.
The comment list can be for the blog as a whole or for an individual post.
Uses: WP_Comment_Query()
No Hooks.
Return
WP_Comment[]|Int[]|Int
. List of comments or number of found comments if $count argument is true.
Usage
get_comments( $args );
- $args(string|array)
- Array or string of arguments. See WP_Comment_Query::__construct() for information on accepted arguments.
Default: ''
Changelog
Since 2.7.0 | Introduced. |
Code of get_comments() get comments WP 6.0
function get_comments( $args = '' ) { $query = new WP_Comment_Query; return $query->query( $args ); }