Post Statuses

These routes allow you to retrieve post statuses.

Possible routes (endpoints are described below):

/wp/v2/statuses           // works with all post statuses
/wp/v2/statuses/{status}  // works with the specified status instead of {status}

Controller class: WP_REST_Post_Statuses_Controller{}

Resource Schema

The schema shows all fields that exist for the object: the fields of the object that the request will return.

Parameter Context Description
name
string
view, edit, embed Name of the status.
Read-only.
private
true/false
edit Should posts with this status be private.
Read-only.
protected
true/false
edit Should posts with this status be protected.
Read-only.
public
true/false
view, edit Should posts with this status be shown to regular users.
Read-only.
queryable
true/false
view, edit Should public queries for posts with this status be allowed.
Read-only.
show_in_list
true/false
edit Should posts be included in the edit list for their post types.
Read-only.
slug
string
view, edit, embed Status slug.
Read-only.

Route Description

An OPTIONS request to the route will return a complete description of this route: endpoints, their parameters, schema.

$ curl -X OPTIONS -i http://demo.wp-api.org/wp-json/wp/v2/statuses
GitHub
{
    "namespace": "wp/v2",
    "methods": [
        "GET"
    ],
    "endpoints": [
        {
            "methods": [
                "GET"
            ],
            "args": {
                "context": {
                    "required": false,
                    "default": "view",
                    "enum": [
                        "view",
                        "embed",
                        "edit"
                    ],
                    "description": "Рамки в которых сделан запрос, определяют поля в ответе.",
                    "type": "string"
                }
            }
        }
    ],
    "schema": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "title": "status",
        "type": "object",
        "properties": {
            "name": {
                "description": "Название статуса.",
                "type": "string",
                "context": [
                    "embed",
                    "view",
                    "edit"
                ],
                "readonly": true
            },
            "private": {
                "description": "Должны ли записи с этим статусом быть личными.",
                "type": "boolean",
                "context": [
                    "edit"
                ],
                "readonly": true
            },
            "protected": {
                "description": "Должны ли быть защищены записи с этим статусом.",
                "type": "boolean",
                "context": [
                    "edit"
                ],
                "readonly": true
            },
            "public": {
                "description": "Показывать ли записи с этим статусом на части сайта для посетителей.",
                "type": "boolean",
                "context": [
                    "view",
                    "edit"
                ],
                "readonly": true
            },
            "queryable": {
                "description": "Разрешать ли публичные запросы записей с этим статусом.",
                "type": "boolean",
                "context": [
                    "view",
                    "edit"
                ],
                "readonly": true
            },
            "show_in_list": {
                "description": "Включать ли записи в список редактирования для их типов записи.",
                "type": "boolean",
                "context": [
                    "edit"
                ],
                "readonly": true
            },
            "slug": {
                "description": "Буквенно-цифровой идентификатор статуса.",
                "type": "string",
                "context": [
                    "embed",
                    "view",
                    "edit"
                ],
                "readonly": true
            }
        }
    },
    "_links": {
        "self": "http://wptest.ru/wp-json/wp/v2/statuses"
    }
}
$ curl -X OPTIONS -i http://demo.wp-api.org/wp-json/wp/v2/statuses/{status}
GitHub
{
    "namespace": "wp/v2",
    "methods": [
        "GET"
    ],
    "endpoints": [
        {
            "methods": [
                "GET"
            ],
            "args": {
                "status": {
                    "required": false,
                    "description": "Буквенно-цифровой идентификатор статуса.",
                    "type": "string"
                },
                "context": {
                    "required": false,
                    "default": "view",
                    "enum": [
                        "view",
                        "embed",
                        "edit"
                    ],
                    "description": "Рамки в которых сделан запрос, определяют поля в ответе.",
                    "type": "string"
                }
            }
        }
    ],
    "schema": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "title": "status",
        "type": "object",
        "properties": {
            "name": {
                "description": "Название статуса.",
                "type": "string",
                "context": [
                    "embed",
                    "view",
                    "edit"
                ],
                "readonly": true
            },
            "private": {
                "description": "Должны ли записи с этим статусом быть личными.",
                "type": "boolean",
                "context": [
                    "edit"
                ],
                "readonly": true
            },
            "protected": {
                "description": "Должны ли быть защищены записи с этим статусом.",
                "type": "boolean",
                "context": [
                    "edit"
                ],
                "readonly": true
            },
            "public": {
                "description": "Показывать ли записи с этим статусом на части сайта для посетителей.",
                "type": "boolean",
                "context": [
                    "view",
                    "edit"
                ],
                "readonly": true
            },
            "queryable": {
                "description": "Разрешать ли публичные запросы записей с этим статусом.",
                "type": "boolean",
                "context": [
                    "view",
                    "edit"
                ],
                "readonly": true
            },
            "show_in_list": {
                "description": "Включать ли записи в список редактирования для их типов записи.",
                "type": "boolean",
                "context": [
                    "edit"
                ],
                "readonly": true
            },
            "slug": {
                "description": "Буквенно-цифровой идентификатор статуса.",
                "type": "string",
                "context": [
                    "embed",
                    "view",
                    "edit"
                ],
                "readonly": true
            }
        }
    }
}

List of All Post Statuses

The algorithm is similar to the function get_post_stati().

Request Type

Access: public

GET /wp/v2/statuses

Request Parameters

context(string)
The context in which the request is made; determines the fields present in the response.
Might be: view, embed, edit
Default: view

Example Request

$ curl http://demo.wp-api.org/wp-json/wp/v2/statuses

Response:

{
	"publish": {
		"name": "Published",
		"public": true,
		"queryable": true,
		"slug": "publish",
		"_links": {
			"archives": [
				{
					"href": "http://example.com/wp-json/wp/v2/posts"
				}
			]
		}
	},
	"future": {
		"name": "Scheduled",
		"public": false,
		"queryable": false,
		"slug": "future",
		"_links": {
			"archives": [
				{
					"href": "http://example.com/wp-json/wp/v2/posts?status=future"
				}
			]
		}
	},
	"draft": {
		"name": "Draft",
		"public": false,
		"queryable": false,
		"slug": "draft",
		"_links": {
			"archives": [
				{
					"href": "http://example.com/wp-json/wp/v2/posts?status=draft"
				}
			]
		}
	},
	"pending": {
		"name": "Pending",
		"public": false,
		"queryable": false,
		"slug": "pending",
		"_links": {
			"archives": [
				{
					"href": "http://example.com/wp-json/wp/v2/posts?status=pending"
				}
			]
		}
	},
	"private": {
		"name": "Private",
		"public": false,
		"queryable": false,
		"slug": "private",
		"_links": {
			"archives": [
				{
					"href": "http://example.com/wp-json/wp/v2/posts?status=private"
				}
			]
		}
	},
	"trash": {
		"name": "Trash",
		"public": false,
		"queryable": false,
		"slug": "trash",
		"_links": {
			"archives": [
				{
					"href": "http://example.com/wp-json/wp/v2/posts?status=trash"
				}
			]
		}
	}
}

Getting a Specific Post Status

Retrieves data for a specific post status.

Request Type

Access: public

GET /wp/v2/statuses/{status}

Request Parameters

status(string) (required)
Name of the status.
context(string)
The context in which the request is made; determines the fields present in the response.
Might be: view, embed, edit
Default: view

Example Request

$ curl http://demo.wp-api.org/wp-json/wp/v2/statuses/publish

Response:

{
	"name": "Published",
	"public": true,
	"queryable": true,
	"slug": "publish",
	"_links": {
		"archives": [
			{
				"href": "http://example.com/wp-json/wp/v2/posts"
			}
		]
	}
}