Resource URL
| Type | URL and Format |
|---|---|
| GET | https://public-api.wordpress.com/rest/v1/sites/$site/posts/slug:$post_slug |
Method Parameters
| Parameter | Type | Description |
|---|---|---|
| $site | (int|string) | The site ID, The site domain |
| $post_slug | (string) | The post slug (a.k.a. sanitized name) |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| context | (string) |
|
| http_envelope | (bool) |
|
| pretty | (bool) |
|
| callback | (string) | An optional JSONP callback function. |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| ID | (int) | The post ID. |
| author | (object) | The author of the post. |
| date | (iso 8601 datetime) | The post's creation time. |
| modified | (iso 8601 datetime) | The post's creation time. |
| title | (html) | context dependent. |
| URL | (url) | The full permalink URL to the post. |
| short_URL | (url) | The wp.me short URL. |
| content | (html) | context dependent. |
| excerpt | (html) | context dependent. |
| slug | (string) | The name (slug) for your post, used in URLs. |
| status | (string) |
|
| password | (string) | The plaintext password protecting the post, or, more likely, the empty string if the post is not password protected. |
| parent | (object|false) | A reference to the post's parent, if it has one. |
| type | (string) | The post's post_type. Post types besides post and page need to be whitelisted using the rest_api_allowed_post_types filter. |
| comments_open | (bool) | Is the post open for comments? |
| pings_open | (bool) | Is the post open for pingbacks, trackbacks? |
| comment_count | (int) | The number of comments for this post. |
| like_count | (int) | The number of likes for this post. |
| i_like | (bool) | Does the current user like this post? |
| is_reblogged | (bool) | Did the current user reblog this post? |
| is_following | (bool) | Is the current user following this blog? |
| featured_image | (url) | The URL to the featured image for this post if it has one. |
| format | (string) |
|
| geo | (object|false) | |
| publicize_URLs | (array) | Array of Twitter and Facebook URLs published by this post. |
| tags | (object) | Hash of tags (keyed by tag name) applied to the post. |
| categories | (object) | Hash of categories (keyed by category name) applied to the post. |
| attachments | (object) | Hash of post attachments (keyed by attachment ID). |
| metadata | (array) | Array of post metadata keys and values. All unprotected meta keys are available by default for read requests. Both unprotected and protected meta keys are avaiable for authenticated requests with access. Protected meta keys can be made available with the rest_api_allowed_public_metadata filter. |
| meta | (object) | API result meta data |
Example
cURL
curl 'https://public-api.wordpress.com/rest/v1/sites/en.blog.wordpress.com/posts/slug:blogging-and-stuff?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/posts/slug:blogging-and-stuff?pretty=1',
false,
$context
);
$response = json_decode( $response );
?>
Response Body
{
"ID": 7,
"author": {
"ID": 5,
"email": false,
"name": "Matt",
"URL": "http:\/\/matt.wordpress.com",
"avatar_URL": "http:\/\/1.gravatar.com\/avatar\/767fc9c115a1b989744c755db47feb60?s=96&d=retro",
"profile_URL": "http:\/\/en.gravatar.com\/matt"
},
"date": "2005-09-26T21:43:58+00:00",
"modified": "2005-09-26T21:43:58+00:00",
"title": "So should we be, like, blogging and stuff too?",
"URL": "http:\/\/en.blog.wordpress.com\/2005\/09\/26\/blogging-and-stuff\/",
"short_URL": "http:\/\/wp.me\/pf2B5-7",
"content": "<p>It is absolutely is criminal we don’t have an official blog for WordPress.com yet. It was all just a ploy to get you to read my, Donncha, Andy, and Ryan’s blogs. But now that the secret is out, we should start blogging officially, and this is as good a place as any. We’re adding new features nearly every day, so at least we’ll have something to write about. <\/p>\n",
"excerpt": "<p>It is absolutely is criminal we don’t have an official blog for WordPress.com yet. It was all just a ploy to get you to read my, Donncha, Andy, and Ryan’s blogs. But now that the secret is out, we should start blogging officially, and this is as good a place as any. We’re adding new […]<\/p>\n",
"slug": "blogging-and-stuff",
"status": "publish",
"password": "",
"parent": false,
"type": "post",
"comments_open": false,
"pings_open": false,
"comment_count": 8,
"like_count": 6,
"i_like": 0,
"is_reblogged": 0,
"is_following": 0,
"featured_image": "",
"format": "standard",
"geo": false,
"publicize_URLs": [
],
"tags": {
"Introduction": {
"name": "Introduction",
"slug": "introduction",
"description": "",
"post_count": 2,
"meta": {
"links": {
"self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/tags\/slug:introduction",
"help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/tags\/slug:introduction\/help",
"site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907"
}
}
}
},
"categories": {
},
"attachments": {
},
"metadata": false,
"meta": {
"links": {
"self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/7",
"help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/7\/help",
"site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907",
"replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/7\/replies\/",
"likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/3584907\/posts\/7\/likes\/"
}
}
}