HTTP/2 301
server: nginx
date: Sat, 27 Dec 2025 16:23:30 GMT
content-type: text/html; charset=UTF-8
x-olaf: ⛄
vary: accept, content-type
x-redirect-by: WordPress
location: https://developer.wordpress.org/reference/functions/get_comments/
x-frame-options: SAMEORIGIN
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 2
HTTP/2 200
server: nginx
date: Sat, 27 Dec 2025 16:23:31 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-olaf: ⛄
vary: accept, content-type
link:
; rel="https://api.w.org/"
link:
; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
x-frame-options: SAMEORIGIN
content-encoding: gzip
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 2
get_comments() – Function | Developer.WordPress.org
get_comments( string|array $args = '' ): WP_Comment[]|int[]|int
Retrieves a list of comments.
The comment list can be for the blog as a whole or for an individual post.
$argsstring|arrayoptionalDefault:''
WP_Comment[]|int[]|int List of comments or number of found comments if $count argument is true.
| 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()