GET /sites/$site/posts/

Get a list of matching posts.

Resource Information

Method GET
Requires authentication? No

Method Parameters

Parameter Type Description
$site (int|string) Site ID or domain

Query Parameters

Parameter Type Description
context (string)
(default) Formats the output as HTML for display. Shortcodes are parsed, paragraph tags are added, etc..
Formats the output for editing. Shortcodes are left unparsed, significant whitespace is kept, etc..
http_envelope (bool)
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)
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 posts to return. Limit: 100. Default: 20.
offset (int) 0-indexed offset.
page (int) Return the Nth 1-indexed page of posts. Takes precedence over the offset parameter.
order (string)
(default) Return posts in descending order. For dates, that means newest to oldest.
Return posts in ascending order. For dates, that means oldest to newest.
order_by (string)
(default) Order by the created time of each post.
Order by the modified time of each post.
Order lexicographically by the posts' titles.
Order by the number of comments for each post.
Order by post ID.
after (iso 8601 datetime) Return posts dated on or after the specified datetime.
before (iso 8601 datetime) Return posts dated on or before the specified datetime.
tag (string) Specify the tag name or slug.
category (string) Specify the category name or slug.
term (object) Specify comma-separated term slugs to search within, indexed by taxonomy slug.
type (string) Specify the post type. Defaults to 'post', use 'any' to query for both posts and pages. Post types besides post and page need to be whitelisted using the rest_api_allowed_post_types filter.
parent_id (int) Returns only posts which are children of the specified post. Applies only to hierarchical post types.
include (array|int) Includes the specified post ID(s) in the response
exclude (array|int) Excludes the specified post ID(s) from the response
exclude_tree (int) Excludes the specified post and all of its descendants from the response. Applies only to hierarchical post types.
status (string)
(default) Return only published posts.
Return only private posts.
Return only draft posts.
Return only posts pending editorial approval.
Return only posts scheduled for future publishing.
Return only posts in the trash.
Return all posts regardless of status.
sticky (bool)
(default) Post is not marked as sticky.
Stick the post to the front page.
author (int) Author's user ID
search (string) Search query
meta_key (string) Metadata key that the post should contain
meta_value (string) Metadata value that the post should contain. Will only be applied if a `meta_key` is also given

Response Parameters

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

Resource Errors

This endpoint does not return any errors.


curl ''
$options  = array (
  'http' => 
  array (
    'ignore_errors' => true,

$context  = stream_context_create( $options );
$response = file_get_contents(
$response = json_decode( $response );