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. 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": 116611,
    "comments": [
        {
            "ID": 209158,
            "post": {
                "ID": 28044,
                "title": "Introducing Site Logos: Personalize Your Blog, Display Your Brand",
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28044"
            },
            "author": {
                "ID": 13132352,
                "login": "kirkwight",
                "email": false,
                "name": "Kirk Wight",
                "nice_name": "kirkwight",
                "URL": "http:\/\/kwight.ca",
                "avatar_URL": "https:\/\/2.gravatar.com\/avatar\/e589ec6c9b981d9da221f206f49dec3d?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/kirkwight",
                "site_ID": 38022806
            },
            "date": "2014-07-28T21:58:19+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/07\/24\/site-logo\/comment-page-1\/#comment-209158",
            "short_URL": "http:\/\/wp.me\/pf2B5-7ik%23comment-209158",
            "content": "<p>Rather than a site logo, check out our Blavatar feature: <a href=\"http:\/\/en.support.wordpress.com\/avatars\/blavatars\/\" rel=\"nofollow\">http:\/\/en.support.wordpress.com\/avatars\/blavatars\/<\/a><\/p>\n",
            "status": "approved",
            "parent": {
                "ID": 209157,
                "type": "comment",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209157"
            },
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209158",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209158\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28044",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209158\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209158\/likes\/"
                }
            }
        },
        {
            "ID": 209157,
            "post": {
                "ID": 28044,
                "title": "Introducing Site Logos: Personalize Your Blog, Display Your Brand",
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28044"
            },
            "author": {
                "ID": 0,
                "login": "",
                "email": false,
                "name": "John Doe",
                "nice_name": "",
                "URL": "https:\/\/plus.google.com\/110055372605976362354",
                "avatar_URL": "https:\/\/0.gravatar.com\/avatar\/02a121da562a6f301b0c5228c4c86182?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/02a121da562a6f301b0c5228c4c86182"
            },
            "date": "2014-07-28T21:19:49+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/07\/24\/site-logo\/comment-page-1\/#comment-209157",
            "short_URL": "http:\/\/wp.me\/pf2B5-7ik%23comment-209157",
            "content": "<p>Any chance there&#8217;ll be an option for .com users to upload a favicon.ico instead of the default WP logo?<\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209157",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209157\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28044",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209157\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209157\/likes\/"
                }
            }
        },
        {
            "ID": 209155,
            "post": {
                "ID": 27988,
                "title": "One Theme, Five Ways: Customizing Adelle",
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/27988"
            },
            "author": {
                "ID": 2193192,
                "login": "michelleweber",
                "email": false,
                "name": "Michelle W.",
                "nice_name": "michelleweber",
                "URL": "http:\/\/kingofstates.com",
                "avatar_URL": "https:\/\/2.gravatar.com\/avatar\/2367004060918e221dcb9799584e9279?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/michelleweber",
                "site_ID": 40536446
            },
            "date": "2014-07-28T19:50:41+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/07\/25\/customizing-adelle\/comment-page-1\/#comment-209155",
            "short_URL": "http:\/\/wp.me\/pf2B5-7hq%23comment-209155",
            "content": "<p>You can always preview different themes, and even play around with customizing them, without actually activating them &#8212; if you head to Appearance &gt;&gt; Themes in your dashboard, you&#8217;ll see that each theme has a &#8220;preview&#8221; button. Your readers will see your regular site while you play around with other options. If you decide you don&#8217;t like the changes, just close out without saving. No harm done!<\/p>\n",
            "status": "approved",
            "parent": {
                "ID": 209153,
                "type": "comment",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209153"
            },
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209155",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209155\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/27988",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209155\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209155\/likes\/"
                }
            }
        },
        {
            "ID": 209153,
            "post": {
                "ID": 27988,
                "title": "One Theme, Five Ways: Customizing Adelle",
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/27988"
            },
            "author": {
                "ID": 41816784,
                "login": "micheleelys",
                "email": false,
                "name": "MicheleElys",
                "nice_name": "micheleelys",
                "URL": "http:\/\/micheleelys.wordpress.com",
                "avatar_URL": "https:\/\/0.gravatar.com\/avatar\/0f44ff28e4cdf2d274fe9fcdb4a4d62c?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/micheleelys",
                "site_ID": 42386704
            },
            "date": "2014-07-28T17:17:31+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/07\/25\/customizing-adelle\/comment-page-1\/#comment-209153",
            "short_URL": "http:\/\/wp.me\/pf2B5-7hq%23comment-209153",
            "content": "<p>HI Michelle,<br \/>\nYou ideas are great and many bloggers have great pages!!<br \/>\nThanks for the updates! I am so afraid of &#8220;customizing&#8221; for the last time I attempted to change the format, and this was after I read the tutorial.  I lost my 1st page, the widget went somewhere, part of my boarder I never could replace. I lost a week in writing time. Would love a broader page and better format, however I am a writer not an IT Geek (who setup wordpress for me in the beginning). Keeping the page simple for readers is less stressful. Thanks for the tip, MicheleElys (first name) Cheers<\/p>\n",
            "status": "approved",
            "parent": false,
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209153",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209153\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/27988",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209153\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209153\/likes\/"
                }
            }
        },
        {
            "ID": 209152,
            "post": {
                "ID": 28044,
                "title": "Introducing Site Logos: Personalize Your Blog, Display Your Brand",
                "type": "post",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28044"
            },
            "author": {
                "ID": 13132352,
                "login": "kirkwight",
                "email": false,
                "name": "Kirk Wight",
                "nice_name": "kirkwight",
                "URL": "http:\/\/kwight.ca",
                "avatar_URL": "https:\/\/2.gravatar.com\/avatar\/e589ec6c9b981d9da221f206f49dec3d?s=96&d=retro",
                "profile_URL": "http:\/\/en.gravatar.com\/kirkwight",
                "site_ID": 38022806
            },
            "date": "2014-07-28T16:30:44+00:00",
            "URL": "http:\/\/en.blog.wordpress.com\/2014\/07\/24\/site-logo\/comment-page-1\/#comment-209152",
            "short_URL": "http:\/\/wp.me\/pf2B5-7ik%23comment-209152",
            "content": "<p>You can request it in the forums: <a href=\"http:\/\/en.forums.wordpress.com\/forum\/themes\" rel=\"nofollow\">http:\/\/en.forums.wordpress.com\/forum\/themes<\/a><\/p>\n",
            "status": "approved",
            "parent": {
                "ID": 209138,
                "type": "comment",
                "link": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209138"
            },
            "type": "comment",
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209152",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209152\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
                    "post": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/28044",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209152\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/comments\/209152\/likes\/"
                }
            }
        }
    ]
}