`/wp/v2/pages`

Namespace: wp/v2
Route: /wp/v2/pages

Routes

  • Collection: /wp/v2/pages
  • Single: /wp/v2/pages/{id}

HTTP Methods

Collection methods: GET, POST

Single methods: GET, POST, PUT, PATCH, DELETE

Request Parameters

Collection GET

ParameterTypeRequiredDefaultDescription
contextstringfalseviewScope under which the request is made; determines fields present in response.
pageintegerfalse1Current page of the collection.
per_pageintegerfalse10Maximum number of items to be returned in result set.
searchstringfalseLimit results to those matching a string.
afterstringfalseLimit response to posts published after a given ISO8601 compliant date.
modified_afterstringfalseLimit response to posts modified after a given ISO8601 compliant date.
authorarrayfalse[]Limit result set to posts assigned to specific authors.
author_excludearrayfalse[]Ensure result set excludes posts assigned to specific authors.
beforestringfalseLimit response to posts published before a given ISO8601 compliant date.
modified_beforestringfalseLimit response to posts modified before a given ISO8601 compliant date.
excludearrayfalse[]Ensure result set excludes specific IDs.
includearrayfalse[]Limit result set to specific IDs.
menu_orderintegerfalseLimit result set to posts with a specific menu_order value.
search_semanticsstringfalseHow to interpret the search input.
offsetintegerfalseOffset the result set by a specific number of items.
orderstringfalsedescOrder sort attribute ascending or descending.
orderbystringfalsedateSort collection by post attribute.
parentarrayfalse[]Limit result set to items with particular parent IDs.
parent_excludearrayfalse[]Limit result set to all items except those of a particular parent ID.
search_columnsarrayfalse[]Array of column names to be searched.
slugarrayfalseLimit result set to posts with one or more specific slugs.
statusarrayfalsepublishLimit result set to posts assigned one or more statuses.
orderby_hierarchybooleanfalseFalseSort pages by hierarchy.

Collection POST

ParameterTypeRequiredDefaultDescription
datestring, nullfalseThe date the post was published, in the site’s timezone.
date_gmtstring, nullfalseThe date the post was published, as GMT.
slugstringfalseAn alphanumeric identifier for the post unique to its type.
statusstringfalseA named status for the post.
passwordstringfalseA password to protect access to the content and excerpt.
parentintegerfalseThe ID for the parent of the post.
titleobjectfalseThe title for the post.
contentobjectfalseThe content for the post.
authorintegerfalseThe ID for the author of the post.
excerptobjectfalseThe excerpt for the post.
featured_mediaintegerfalseThe ID of the featured media for the post.
comment_statusstringfalseWhether or not comments are open on the post.
ping_statusstringfalseWhether or not the post can be pinged.
menu_orderintegerfalseThe order of the post in relation to other posts.
metaobjectfalseMeta fields.
templatestringfalseThe theme file to use to display the post.
jetpack_sharing_enabledbooleanfalseAre sharing buttons enabled?

Single GET

ParameterTypeRequiredDefaultDescription
idintegerfalseUnique identifier for the post.
contextstringfalseviewScope under which the request is made; determines fields present in response.
excerpt_lengthintegerfalseOverride the default excerpt length.
passwordstringfalseThe password for the post if it is password protected.

Single POST, PUT, PATCH

ParameterTypeRequiredDefaultDescription
idintegerfalseUnique identifier for the post.
datestring, nullfalseThe date the post was published, in the site’s timezone.
date_gmtstring, nullfalseThe date the post was published, as GMT.
slugstringfalseAn alphanumeric identifier for the post unique to its type.
statusstringfalseA named status for the post.
passwordstringfalseA password to protect access to the content and excerpt.
parentintegerfalseThe ID for the parent of the post.
titleobjectfalseThe title for the post.
contentobjectfalseThe content for the post.
authorintegerfalseThe ID for the author of the post.
excerptobjectfalseThe excerpt for the post.
featured_mediaintegerfalseThe ID of the featured media for the post.
comment_statusstringfalseWhether or not comments are open on the post.
ping_statusstringfalseWhether or not the post can be pinged.
menu_orderintegerfalseThe order of the post in relation to other posts.
metaobjectfalseMeta fields.
templatestringfalseThe theme file to use to display the post.
jetpack_sharing_enabledbooleanfalseAre sharing buttons enabled?

Single DELETE

ParameterTypeRequiredDefaultDescription
idintegerfalseUnique identifier for the post.
forcebooleanfalseFalseWhether to bypass Trash and force deletion.

Response Schema (Item)

FieldTypeDescription
datestring, nullThe date the post was published, in the site’s timezone.
date_gmtstring, nullThe date the post was published, as GMT.
guidobjectThe globally unique identifier for the post. (read-only)
idintegerUnique identifier for the post. (read-only)
linkstringURL to the post. (read-only)
modifiedstringThe date the post was last modified, in the site’s timezone. (read-only)
modified_gmtstringThe date the post was last modified, as GMT. (read-only)
slugstringAn alphanumeric identifier for the post unique to its type.
statusstringA named status for the post.
typestringType of post. (read-only)
passwordstringA password to protect access to the content and excerpt.
permalink_templatestringPermalink template for the post. (read-only)
generated_slugstringSlug automatically generated from the post title. (read-only)
class_listarrayAn array of the class names for the post container element. (read-only)
parentintegerThe ID for the parent of the post.
titleobjectThe title for the post.
contentobjectThe content for the post.
authorintegerThe ID for the author of the post.
excerptobjectThe excerpt for the post.
featured_mediaintegerThe ID of the featured media for the post.
comment_statusstringWhether or not comments are open on the post.
ping_statusstringWhether or not the post can be pinged.
menu_orderintegerThe order of the post in relation to other posts.
metaobjectMeta fields.
templatestringThe theme file to use to display the post.
jetpack_sharing_enabledbooleanAre sharing buttons enabled?

Authentication

  • Read: public for published pages; edit_pages required to view protected/private pages.
  • Write: edit_pages (create/update), publish_pages (publish), delete_pages (delete).

Example Requests

bash
curl -X GET "https://wordpress.org/news/wp-json/wp/v2/pages"
bash
curl -X POST "https://wordpress.org/news/wp-json/wp/v2/pages" 
  -H 'Authorization: Basic <app-password>' 
  -H 'Content-Type: application/json' 
  -d '{"title":"Example"}'
bash
curl -X GET "https://wordpress.org/news/wp-json/wp/v2/pages/1"

Example Response (trimmed)

json
{
  "id": 1,
  "_links": {
    "self": [{ "href": "/wp/v2/pages/1" }]
  }
}