HTTP/2 301
server: nginx
date: Fri, 10 Oct 2025 23:45:23 GMT
content-type: text/html; charset=UTF-8
location: https://developer.wordpress.org/reference/functions/get_comments
x-content-type-options: nosniff
content-language: en
x-ua-compatible: IE=Edge
vary: Accept-Encoding, Cookie
expires: Thu, 01 Jan 1970 00:00:00 GMT
cache-control: no-cache, no-store, max-age=0, must-revalidate
pragma: no-cache
alt-svc: h3=":443"; ma=86400
strict-transport-security: max-age=31536000
HTTP/2 301
server: nginx
date: Fri, 10 Oct 2025 23:45:25 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 1
HTTP/2 200
server: nginx
date: Fri, 10 Oct 2025 23:45:26 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 1
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.
$args
string|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()