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
callback (string) An optional JSONP callback function.
number (int) The number of comments to return. Limit: 100. Default: 20.
offset (int) 0-indexed offset.
page (int) Return the Nth 1-indexed page of comments. Takes precedence over the offset parameter.
order (string)
DESC:
(default) Return comments in descending order from newest to oldest.
ASC:
Return comments in ascending order from oldest to newest.
after (iso 8601 datetime) Return comments dated on or after the specified datetime.
before (iso 8601 datetime) Return comments dated on or before the specified datetime.
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": 114342,
    "comments": [
        {
            "ID": 201973,
            "post": {
                "ID": 26428,
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/26428"
            },
            "author": {
                "ID": 79,
                "email": false,
                "name": "Ryan Boren",
                "nice_name": "ryan",
                "URL": "http:\/\/ryan.boren.me\/",
                "avatar_URL": "https:\/\/0.gravatar.com\/avatar\/c22398fb9602c967d1dac8174f4a1a4e?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/ryan",
                "site_ID": 78
            },
            "date": "2014-04-18T08:01:09+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/04\/17\/transparency-report\/comment-page-1\/#comment-201973",
            "short_URL": "http:\/\/wp.me\/pf2B5-6Sg%23comment-201973",
            "content": "<p>Reblogged this on <a href=\"http:\/\/ryan.boren.me\/2014\/04\/18\/the-wordpress-com-transparency-report\/\" rel=\"nofollow\">Ryan Boren<\/a> and commented: <\/p>\n<p>&#8220;We\u2019re reporting the maximum amount of information allowed by law about the number and types of National Security Requests that we received. The disclosures we\u2019re currently allowed to make are limited, and unfortunately, we\u2019re not permitted to paint a more truthful picture.&#8221;<\/p>\n<p>Being forced by your government to lie and obscure is corrosive, soul-rotting, and evil. I got into WordPress and web publishing to help people speak past the lumps their governments try to lodge in their throats. This report is important speech, saying what it can around the lumps, and I&#8217;m proud of it.<\/p>\n<p>&#8220;We wish we could tell you more.&#8221;<\/p>\n<p>Chilling, isn&#8217;t it?<\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/201973",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/201973\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/26428",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/201973\/replies\/"
                }
            }
        },
        {
            "ID": 201972,
            "post": {
                "ID": 26428,
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/26428"
            },
            "author": {
                "ID": 58399514,
                "email": false,
                "name": "Steve",
                "nice_name": "clickysteve",
                "URL": "http:\/\/iamsteve.in",
                "avatar_URL": "https:\/\/1.gravatar.com\/avatar\/d32c5250fa45b147517f293235417136?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/clickysteve",
                "site_ID": 56901699
            },
            "date": "2014-04-18T07:51:49+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/04\/17\/transparency-report\/comment-page-1\/#comment-201972",
            "short_URL": "http:\/\/wp.me\/pf2B5-6Sg%23comment-201972",
            "content": "<p>Reblogged this on <a href=\"http:\/\/clickysteve.wordpress.com\/2014\/04\/18\/the-wordpress-com-transparency-report\/\" rel=\"nofollow\">clickysteve<\/a> and commented: <\/p>\n<p>Very proud to be part of a team of people who genuinely fight for users, and so happy to see this. <\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/201972",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/201972\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/26428",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/201972\/replies\/"
                }
            }
        },
        {
            "ID": 201955,
            "post": {
                "ID": 26468,
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/26468"
            },
            "author": {
                "ID": 40033626,
                "email": false,
                "name": "A Writer Inspired",
                "nice_name": "awriterinspired",
                "URL": "http:\/\/awriterinspired.wordpress.com",
                "avatar_URL": "https:\/\/2.gravatar.com\/avatar\/231ac8bb83d4e587952ade8664ed489c?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/awriterinspired",
                "site_ID": 40596714
            },
            "date": "2014-04-18T00:51:41+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/04\/17\/fictive\/comment-page-1\/#comment-201955",
            "short_URL": "http:\/\/wp.me\/sf2B5-fictive%23comment-201955",
            "content": "<p>So happy that it&#8217;s free! I really like this one! For the first time I was able to do a Live Demo and it rendered my content beautifully without any customization. That&#8217;s never happened before. The only thing I miss is my full-width page options. The readability though makes it almost worth it. I may be back to this one after April.<\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/201955",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/201955\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/26468",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/201955\/replies\/"
                }
            }
        },
        {
            "ID": 201952,
            "post": {
                "ID": 26468,
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/26468"
            },
            "author": {
                "ID": 37576871,
                "email": false,
                "name": "ruphel",
                "nice_name": "ruphel",
                "URL": "http:\/\/cyberdesigncraft.com",
                "avatar_URL": "https:\/\/2.gravatar.com\/avatar\/b8d258057a5fde126d9704cd0aa29f2b?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/ruphel",
                "site_ID": 54204745
            },
            "date": "2014-04-18T00:08:55+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/04\/17\/fictive\/comment-page-1\/#comment-201952",
            "short_URL": "http:\/\/wp.me\/sf2B5-fictive%23comment-201952",
            "content": "<p>Love the responsive menu, up there with Sorbet, great theme, well done <span class='wp-smiley emoji emoji-smile' title=':)'>:)<\/span><\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/201952",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/201952\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/26468",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/201952\/replies\/"
                }
            }
        },
        {
            "ID": 201949,
            "post": {
                "ID": 26468,
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/26468"
            },
            "author": {
                "ID": 52517349,
                "email": false,
                "name": "foundfootageblog.com",
                "nice_name": "radicaljournalmadamex",
                "URL": "http:\/\/radicaljournalmadamex.wordpress.com",
                "avatar_URL": "https:\/\/0.gravatar.com\/avatar\/089204cd5f70db0167d13e64210fdf72?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/radicaljournalmadamex",
                "site_ID": 54934201
            },
            "date": "2014-04-17T23:53:38+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/04\/17\/fictive\/comment-page-1\/#comment-201949",
            "short_URL": "http:\/\/wp.me\/sf2B5-fictive%23comment-201949",
            "content": "<p>I really like the simplicity of this- I&#8217;m trying it!<\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/201949",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/201949\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/26468",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/201949\/replies\/"
                }
            }
        }
    ]
}