GET /sites/$site/comments/

Return recent Comments

Resource URL

Type URL and Format
GET https://public-api.wordpress.com/rest/v1/sites/$site/comments/

Method Parameters

Parameter Type Description
$site (int|string) The site ID, The site domain

Query Parameters

Parameter Type Description
context (string)
display:
(default) Formats the output as HTML for display. Shortcodes are parsed, paragraph tags are added, etc..
edit:
Formats the output for editing. Shortcodes are left unparsed, significant whitespace is kept, etc..
http_envelope (bool)
false:
(default)
true:
Some environments (like in-browser Javascript or Flash) block or divert responses with a non-200 HTTP status code. Setting this parameter will force the HTTP status code to always be 200. The JSON response is wrapped in an "envelope" containing the "real" HTTP status code and headers.
pretty (bool)
false:
(default)
true:
Output pretty JSON
meta (string) Optional. Loads data from the endpoints found in the 'meta' part of the response. Comma separated list. Example: meta=site,likes
fields (string) Optional. Returns specified fields only. Comma separated list. Example: fields=ID,title
callback (string) An optional JSONP callback function.
number (int) The number of comments to return. Limit: 100. When using hierarchical=1, number refers to the number of top-level comments returned. Default: 20.
offset (int) 0-indexed offset. Not available if using hierarchical=1.
page (int) Return the Nth 1-indexed page of comments. Takes precedence over the offset parameter. When using hierarchical=1, pagination is a bit different. See the note on the number parameter.
order (string)
DESC:
(default) Return comments in descending order from newest to oldest.
ASC:
Return comments in ascending order from oldest to newest.
hierarchical (bool)
false:
(default)
true:
(BETA) Order the comment list hierarchically.
after (iso 8601 datetime) Return comments dated on or after the specified datetime. Not available if using hierarchical=1.
before (iso 8601 datetime) Return comments dated on or before the specified datetime. Not available if using hierarchical=1.
type (string)
any:
(default) Return all comments regardless of type.
comment:
Return only regular comments.
trackback:
Return only trackbacks.
pingback:
Return only pingbacks.
pings:
Return both trackbacks and pingbacks.
status (string)
approved:
(default) Return only approved comments.
unapproved:
Return only comments in the moderation queue.
spam:
Return only comments marked as spam.
trash:
Return only comments in the trash.
all:
Return comments of all statuses.

Response Parameters

Parameter Type Description
found (int) The total number of comments found that match the request (ignoring limits, offsets, and pagination).
comments (array) An array of comment objects.

Example

cURL

curl 'https://public-api.wordpress.com/rest/v1/sites/en.blog.wordpress.com/comments/?number=5&pretty=1'

PHP

<?php

$options  = array (
  'http' => 
  array (
    'ignore_errors' => true,
  ),
);

$context  = stream_context_create( $options );
$response = file_get_contents(
  'https://public-api.wordpress.com/rest/v1/sites/en.blog.wordpress.com/comments/?number=5&pretty=1',
  false,
  $context
);
$response = json_decode( $response );

?>

Response Body

{
    "found": 118179,
    "comments": [
        {
            "ID": 213316,
            "post": {
                "ID": 29024,
                "title": "A New My Sites Section",
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/29024"
            },
            "author": {
                "ID": 33524892,
                "login": "jeremeylduvall",
                "email": false,
                "name": "Jeremey DuVall",
                "nice_name": "jeremeylduvall",
                "URL": "http:\/\/superordinary.co",
                "avatar_URL": "https:\/\/0.gravatar.com\/avatar\/681341319845098001b8734c42f37eae?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/jeremeylduvall",
                "site_ID": 71100700
            },
            "date": "2014-10-22T20:47:07+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/10\/21\/a-new-my-sites-section\/comment-page-1\/#comment-213316",
            "short_URL": "http:\/\/wp.me\/pf2B5-7y8%23comment-213316",
            "content": "<p>Can you contact us here? <a href=\"http:\/\/en.support.wordpress.com\/contact\/\" rel=\"nofollow\">http:\/\/en.support.wordpress.com\/contact\/<\/a><\/p>\n<p>We can help walk you through the process of transferring the blogs to the same account. The basic steps are outlined here:<\/p>\n<p><a href=\"http:\/\/en.support.wordpress.com\/moving-a-blog\/#transferring-your-blog-to-another-wordpress-com-user-or-account\" rel=\"nofollow\">http:\/\/en.support.wordpress.com\/moving-a-blog\/#transferring-your-blog-to-another-wordpress-com-user-or-account<\/a><\/p>\n<p>You&#8217;ll need to login to the admin account for each blog and transfer the blogs to a common account.<\/p>\n",
            "status": "approved",
            "parent": {
                "ID": 213275,
                "type": "comment",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213275"
            },
            "type": "comment",
            "like_count": 0,
            "i_like": false,
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213316",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213316\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/29024",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213316\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213316\/likes\/"
                }
            }
        },
        {
            "ID": 213315,
            "post": {
                "ID": 29024,
                "title": "A New My Sites Section",
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/29024"
            },
            "author": {
                "ID": 33524892,
                "login": "jeremeylduvall",
                "email": false,
                "name": "Jeremey DuVall",
                "nice_name": "jeremeylduvall",
                "URL": "http:\/\/superordinary.co",
                "avatar_URL": "https:\/\/0.gravatar.com\/avatar\/681341319845098001b8734c42f37eae?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/jeremeylduvall",
                "site_ID": 71100700
            },
            "date": "2014-10-22T20:45:14+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/10\/21\/a-new-my-sites-section\/comment-page-1\/#comment-213315",
            "short_URL": "http:\/\/wp.me\/pf2B5-7y8%23comment-213315",
            "content": "<p>I&#8217;ve responded to your request in the forums here:<\/p>\n<p><a href=\"http:\/\/en.forums.wordpress.com\/topic\/lost-my-followers-in-one-click?replies=2\" rel=\"nofollow\">http:\/\/en.forums.wordpress.com\/topic\/lost-my-followers-in-one-click?replies=2<\/a><\/p>\n<p>Can you reply back there?<\/p>\n",
            "status": "approved",
            "parent": {
                "ID": 213276,
                "type": "comment",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213276"
            },
            "type": "comment",
            "like_count": 0,
            "i_like": false,
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213315",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213315\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/29024",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213315\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213315\/likes\/"
                }
            }
        },
        {
            "ID": 213314,
            "post": {
                "ID": 29024,
                "title": "A New My Sites Section",
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/29024"
            },
            "author": {
                "ID": 33524892,
                "login": "jeremeylduvall",
                "email": false,
                "name": "Jeremey DuVall",
                "nice_name": "jeremeylduvall",
                "URL": "http:\/\/superordinary.co",
                "avatar_URL": "https:\/\/0.gravatar.com\/avatar\/681341319845098001b8734c42f37eae?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/jeremeylduvall",
                "site_ID": 71100700
            },
            "date": "2014-10-22T20:41:47+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/10\/21\/a-new-my-sites-section\/comment-page-1\/#comment-213314",
            "short_URL": "http:\/\/wp.me\/pf2B5-7y8%23comment-213314",
            "content": "<p>Ah &#8211; I think we&#8217;re on the same page now. Previously, there was a link within the toolbar on the upper right-hand side that took you to the Dashboard of your primary site. Here&#8217;s the toolbar I&#8217;m referring to:<\/p>\n<p><a href=\"https:\/\/cloudup.com\/c082Pw7L3xR\"><img src=\"https:\/\/i.cloudup.com\/l-vRSgbN_m-2000x2000.png\" alt=\"Screen Shot 2014 10 22 at 2 39 51 PM\" width=\"289\" height=\"350\" \/><\/a><\/p>\n<p>That link has been removed in favor of the My Sites page. To navigate to the Dashboard now, you&#8217;ll need to use the gear icon on the My Sites page located on top of each site.<\/p>\n",
            "status": "approved",
            "parent": {
                "ID": 213256,
                "type": "comment",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213256"
            },
            "type": "comment",
            "like_count": 0,
            "i_like": false,
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213314",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213314\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/29024",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213314\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213314\/likes\/"
                }
            }
        },
        {
            "ID": 213310,
            "post": {
                "ID": 29024,
                "title": "A New My Sites Section",
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/29024"
            },
            "author": {
                "ID": 50727,
                "login": "apeatling",
                "email": false,
                "name": "Andy Peatling",
                "nice_name": "apeatling",
                "URL": "http:\/\/apeatling.wordpress.com",
                "avatar_URL": "https:\/\/0.gravatar.com\/avatar\/0939030c354e4efefe655fa5107fd888?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/apeatling",
                "site_ID": 51599
            },
            "date": "2014-10-22T19:22:28+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/10\/21\/a-new-my-sites-section\/comment-page-1\/#comment-213310",
            "short_URL": "http:\/\/wp.me\/pf2B5-7y8%23comment-213310",
            "content": "<p>Please contact support so we can help you out and get more details.<\/p>\n",
            "status": "approved",
            "parent": {
                "ID": 213285,
                "type": "comment",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213285"
            },
            "type": "comment",
            "like_count": 0,
            "i_like": false,
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213310",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213310\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/29024",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213310\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213310\/likes\/"
                }
            }
        },
        {
            "ID": 213309,
            "post": {
                "ID": 29024,
                "title": "A New My Sites Section",
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/29024"
            },
            "author": {
                "ID": 50727,
                "login": "apeatling",
                "email": false,
                "name": "Andy Peatling",
                "nice_name": "apeatling",
                "URL": "http:\/\/apeatling.wordpress.com",
                "avatar_URL": "https:\/\/0.gravatar.com\/avatar\/0939030c354e4efefe655fa5107fd888?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/apeatling",
                "site_ID": 51599
            },
            "date": "2014-10-22T19:22:06+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/10\/21\/a-new-my-sites-section\/comment-page-1\/#comment-213309",
            "short_URL": "http:\/\/wp.me\/pf2B5-7y8%23comment-213309",
            "content": "<p>If you select a site in the dropdown, the navigation will change and be dedicated to showing options for that site only.<\/p>\n",
            "status": "approved",
            "parent": {
                "ID": 213284,
                "type": "comment",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213284"
            },
            "type": "comment",
            "like_count": 0,
            "i_like": false,
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213309",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213309\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/29024",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213309\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/213309\/likes\/"
                }
            }
        }
    ]
}