Settings (options)
This route allows you to get/update the settings of the WordPress site. However, only the main settings can be updated this way (not all).
Route (endpoints are described below):
/wp/v2/settings
Controller class: WP_REST_Settings_Controller{}
Resource Schema
The schema shows all fields that exist for the object: the fields of the object that the request will return.
| Parameter | Description |
|---|---|
| title string |
Site title. |
| description string |
Site slogan. |
| url string |
Site address (URL) |
| email string |
Administrator's email. Used, for example, for notifications about new users. |
| timezone string |
City in the same time zone as you. |
| date_format string |
General date format. |
| time_format string |
General time format. |
| start_of_week number |
First day of the week. |
| language string |
WordPress locale code. |
| use_smilies true/false |
Convert smileys like 🙂 and 😛 into images when displayed. |
| default_category number |
Default category for posts. |
| default_post_format string |
Default post format. |
| posts_per_page number |
Maximum number of posts to display on a page. |
| default_ping_status string |
Allow pingback links from other blogs (notifications and backlinks) to new articles. Can be open, closed. |
| default_comment_status string |
Allow comments on new articles. Can be open, closed. |
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/settingsGitHub
Getting Settings
Gets all settings of the site specified in the schema. See also the function get_option().
Request Type
Access: authorization required
GET /wp/v2/settings
Request Parameters
No parameters.
Example Request
$ curl http://demo.wp-api.org/wp-json/wp/v2/settings
Response:
{
"title": "WordPress at a Glance",
"description": "Working with WordPress",
"url": "http://example.com/wp",
"email": "[email protected]",
"timezone": "",
"date_format": "F j, Y",
"time_format": "g:i a",
"start_of_week": 1,
"language": "ru_RU",
"use_smilies": true,
"default_category": 1,
"default_post_format": "0",
"posts_per_page": 10,
"default_ping_status": "open",
"default_comment_status": "open"
}
Updating Settings
Updates the specified setting. Only the settings specified in the schema can be updated. See also the function update_option().
Request Type
Access: authorization required
POST|PUT|PATCH /wp/v2/settings
Request Parameters
"title": {
"required": false,
"description": "Site title.",
"type": "string"
},
"description": {
"required": false,
"description": "Site slogan.",
"type": "string"
},
"url": {
"required": false,
"description": "Site address (URL)",
"type": "string"
},
"email": {
"required": false,
"description": "This address is used for administration purposes. For example, for notifications about new users.",
"type": "string"
},
"timezone": {
"required": false,
"description": "City in the same time zone as you.",
"type": "string"
},
"date_format": {
"required": false,
"description": "General date format.",
"type": "string"
},
"time_format": {
"required": false,
"description": "General time format.",
"type": "string"
},
"start_of_week": {
"required": false,
"description": "First day of the week.",
"type": "integer"
},
"language": {
"required": false,
"description": "WordPress locale code.",
"type": "string"
},
"use_smilies": {
"required": false,
"description": "Convert smileys like :-) and :-P into images when displayed.",
"type": "boolean"
},
"default_category": {
"required": false,
"description": "Default category for posts.",
"type": "integer"
},
"default_post_format": {
"required": false,
"description": "Default post format.",
"type": "string"
},
"posts_per_page": {
"required": false,
"description": "Maximum number of blog pages to display.",
"type": "integer"
},
"default_ping_status": {
"required": false,
"enum": [
"open",
"closed"
],
"description": "Allow pingback links from other blogs (notifications and backlinks) to new articles.",
"type": "string"
},
"default_comment_status": {
"required": false,
"enum": [
"open",
"closed"
],
"description": "Allow comments on new articles.",
"type": "string"
}
Example Request
$ curl -X POST -i http://demo.wp-api.org/wp-json/wp/v2/settings?title=New site title
Response:
{
"title": "New site title",
"description": "Working with WordPress",
"url": "http://example.com/wp",
"email": "[email protected]",
"timezone": "",
"date_format": "F j, Y",
"time_format": "g:i a",
"start_of_week": 1,
"language": "ru_RU",
"use_smilies": true,
"default_category": 1,
"default_post_format": "0",
"posts_per_page": 10,
"default_ping_status": "open",
"default_comment_status": "open"
}