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": 117108,
    "comments": [
        {
            "ID": 210484,
            "post": {
                "ID": 28349,
                "title": "Ferguson: Ten Bloggers Speak Out",
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28349"
            },
            "author": {
                "ID": 57744960,
                "login": "neighsayer",
                "email": false,
                "name": "neighsayer",
                "nice_name": "neighsayer",
                "URL": "http:\/\/punishmenthurtseveryone.wordpress.com",
                "avatar_URL": "https:\/\/2.gravatar.com\/avatar\/526fdd01b7abd032c5d3b2fb0ca79edd?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/neighsayer",
                "site_ID": 60353879
            },
            "date": "2014-08-23T05:31:43+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/08\/22\/ferguson-bloggers-roundup\/comment-page-1\/#comment-210484",
            "short_URL": "http:\/\/wp.me\/pf2B5-7nf%23comment-210484",
            "content": "<p>in the spirit of variety, perhaps some may like to see this perspective, from my post:<\/p>\n<p>Curing Crime<br \/>\nPosted on August 20, 2014<br \/>\n          I know, no-one dreams of actually curing crime, not adults, not really. It\u2019s just one of the fantasies we teach our kids, that anyone is actually fighting some abstraction called \u201ccrime,\u201d be it fictional heroes and super-heroes, or the real, live police along with the rest of the criminal justice system.<\/p>\n<p>          Any adult knows that once we create institutions, they have their own instinct for survival, and it\u2019s no secret lately that the criminal justice system is big business . . . so like everything else in the money system, the very people who might have been tasked with \u201ccuring crime\u201d are the last people who might want to actually do it. But it\u2019s not just the prison moguls, it\u2019s all of us who aren\u2019t curing crime, and I can see another part of the problem. It came to me while commenting on another post tonight.<\/p>\n<p>          We, as a society, have yet to define the crimes in the first place. Take for instance, violence, up to and including murder. Crimes, right? Not so much. These things are not crimes in themselves \u2013 I mean they are, they are, in reality \u2013 but not in our societies, our human societies. In many contexts, violence and murder are seen as solutions to crime and misbehaviour. It\u2019s not \u201cmurder\u201d when the good guys do it, apparently.<\/p>\n<p>          So, here\u2019s the point. No-one is fighting these abstractions, \u201cviolence,\u201d \u201cmurder.\u201d These are still unidentified as problems and they are often identified as solutions instead. So we must realize that these things are not considered to be inherently criminal. So if murder is not clearly in the \u201ccrime\u201d section of our minds, what is? How can we stamp out violence and murder when we, as a society do not perceive them to be inherently criminal?<\/p>\n<p>          We must realize that no-one is fighting \u201ccrime.\u201d We are only fighting some of the people who commit these \u201ccrimes,\u201d and using these very same activities to do it. And that is what we keep coming up against, every time the police do what they do for us in an overly public or blatant way, every time they cross \u201cthe line.\u201d We are seeing the truth, that it is the people who commit crimes that our societies, through our police and criminal justice systems are fighting, and the actual \u201ccrimes,\u201d violence and murder, walk free, never even accused.<\/p>\n<p>          We need to put violence and murder in the \u201ccrime\u201d side of the ledger if we are ever to even begin the fight against them. If murder and violence might ever be stopped, then the good guys can\u2019t be allowed to do it either.<\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210484",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210484\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28349",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210484\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210484\/likes\/"
                }
            }
        },
        {
            "ID": 210482,
            "post": {
                "ID": 28349,
                "title": "Ferguson: Ten Bloggers Speak Out",
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28349"
            },
            "author": {
                "ID": 66183383,
                "login": "vernonp",
                "email": false,
                "name": "vernon",
                "nice_name": "vernonp",
                "URL": "http:\/\/mrspockrocks.wordpress.com",
                "avatar_URL": "https:\/\/2.gravatar.com\/avatar\/e0ad3189068d7bea775ae64dd40bdf3a?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/vernonp",
                "site_ID": 69215325
            },
            "date": "2014-08-23T04:49:36+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/08\/22\/ferguson-bloggers-roundup\/comment-page-1\/#comment-210482",
            "short_URL": "http:\/\/wp.me\/pf2B5-7nf%23comment-210482",
            "content": "<p>I lived in St. Louis county off-and-on over about 10 years, and have a different take on it here:<\/p>\n<p><a href=\"http:\/\/mr-spock-rocks.com\/2014\/08\/18\/spiritual-growth-ferguson-mo\/\" rel=\"nofollow\">http:\/\/mr-spock-rocks.com\/2014\/08\/18\/spiritual-growth-ferguson-mo\/<\/a><\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210482",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210482\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28349",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210482\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210482\/likes\/"
                }
            }
        },
        {
            "ID": 210475,
            "post": {
                "ID": 28349,
                "title": "Ferguson: Ten Bloggers Speak Out",
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28349"
            },
            "author": {
                "ID": 21216117,
                "login": "charlotteortega",
                "email": false,
                "name": "Charlotte Ortega",
                "nice_name": "charlotteortega",
                "URL": "http:\/\/info4youonmexico.wordpress.com",
                "avatar_URL": "https:\/\/2.gravatar.com\/avatar\/2188874d3723422461b043cce1d8ce64?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/charlotteortega",
                "site_ID": 20626429
            },
            "date": "2014-08-23T02:03:50+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/08\/22\/ferguson-bloggers-roundup\/comment-page-1\/#comment-210475",
            "short_URL": "http:\/\/wp.me\/pf2B5-7nf%23comment-210475",
            "content": "<p>Here we are in 2014 and it seems to me that one black life does not equal the value of one white life. Perhaps we are deluding ourselves that human rights are further along than they really are.This is a concern for anyone at a demographic disadvantage.<\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210475",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210475\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28349",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210475\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210475\/likes\/"
                }
            }
        },
        {
            "ID": 210474,
            "post": {
                "ID": 28349,
                "title": "Ferguson: Ten Bloggers Speak Out",
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28349"
            },
            "author": {
                "ID": 68496101,
                "login": "nhk49",
                "email": false,
                "name": "nhk49",
                "nice_name": "nhk49",
                "URL": "https:\/\/nhk49.wordpress.com",
                "avatar_URL": "https:\/\/1.gravatar.com\/avatar\/7c971a18f23b0f0ab108364e0bc5ae29?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/nhk49",
                "site_ID": 72088435
            },
            "date": "2014-08-23T01:25:50+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/08\/22\/ferguson-bloggers-roundup\/comment-page-1\/#comment-210474",
            "short_URL": "http:\/\/wp.me\/pf2B5-7nf%23comment-210474",
            "content": "<p>More people are becoming aware of what is happening about Michael Brown in Ferguson, Mo.. However what is really happening in Ferguson is that the killing of Black people is being undermined by bringing up past events as if to say this isn&#8217;t so bad. It&#8217;s time to look at thing (past and present) as it is. Don&#8217;t let what you don&#8217;t know but have heard persuade you. Tragic events that occur are all so sade when they come  from a sources that dictate events as untruth, half truth and outright lies. I can&#8217;t leave without saying that we all have choices and the choice you take in dealing with things is your choice. Don&#8217;t condemn others for the choices they are forced to make for themselves.<\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210474",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210474\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28349",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210474\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210474\/likes\/"
                }
            }
        },
        {
            "ID": 210468,
            "post": {
                "ID": 28349,
                "title": "Ferguson: Ten Bloggers Speak Out",
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28349"
            },
            "author": {
                "ID": 47411601,
                "login": "benhuberman",
                "email": false,
                "name": "Ben Huberman",
                "nice_name": "benhuberman",
                "URL": "",
                "avatar_URL": "https:\/\/0.gravatar.com\/avatar\/663dcd498e8c5f255bfb230a7ba07678?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/benhuberman",
                "site_ID": 48638359
            },
            "date": "2014-08-22T21:36:56+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/08\/22\/ferguson-bloggers-roundup\/comment-page-1\/#comment-210468",
            "short_URL": "http:\/\/wp.me\/pf2B5-7nf%23comment-210468",
            "content": "<p>I welcome suggestions of more local bloggers, of course &#8212; feel free to share.<\/p>\n",
            "status": "approved",
            "parent": {
                "ID": 210466,
                "type": "comment",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210466"
            },
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210468",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210468\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28349",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210468\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/210468\/likes\/"
                }
            }
        }
    ]
}