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/settings
GitHub
{
    "namespace": "wp/v2",
    "methods": [
        "GET",
        "POST",
        "PUT",
        "PATCH"
    ],
    "endpoints": [
        {
            "methods": [
                "GET"
            ],
            "args": []
        },
        {
            "methods": [
                "POST",
                "PUT",
                "PATCH"
            ],
            "args": {
                "title": {
                    "required": false,
                    "description": "Название сайта.",
                    "type": "string"
                },
                "description": {
                    "required": false,
                    "description": "Слоган сайта.",
                    "type": "string"
                },
                "url": {
                    "required": false,
                    "description": "Адрес сайта (URL)",
                    "type": "string"
                },
                "email": {
                    "required": false,
                    "description": "Этот адрес используется в целях администрирования. Например, для уведомления о новых пользователях.",
                    "type": "string"
                },
                "timezone": {
                    "required": false,
                    "description": "Город в той же временной зоне что и у вас.",
                    "type": "string"
                },
                "date_format": {
                    "required": false,
                    "description": "Общий формат даты.",
                    "type": "string"
                },
                "time_format": {
                    "required": false,
                    "description": "Общий формат времени.",
                    "type": "string"
                },
                "start_of_week": {
                    "required": false,
                    "description": "Первый день недели.",
                    "type": "integer"
                },
                "language": {
                    "required": false,
                    "description": "Код локали WordPress.",
                    "type": "string"
                },
                "use_smilies": {
                    "required": false,
                    "description": "Преобразовывать смайлики наподобие :-) и :-P в картинки при показе.",
                    "type": "boolean"
                },
                "default_category": {
                    "required": false,
                    "description": "Рубрика для записей по умолчанию.",
                    "type": "integer"
                },
                "default_post_format": {
                    "required": false,
                    "description": "Формат записей по умолчанию.",
                    "type": "string"
                },
                "posts_per_page": {
                    "required": false,
                    "description": "Максимум страниц блога для показа.",
                    "type": "integer"
                },
                "default_ping_status": {
                    "required": false,
                    "enum": [
                        "open",
                        "closed"
                    ],
                    "description": "Разрешить ссылки оповещения с других блогов (уведомления и обратные ссылки) на новые статьи.",
                    "type": "string"
                },
                "default_comment_status": {
                    "required": false,
                    "enum": [
                        "open",
                        "closed"
                    ],
                    "description": "Разрешить отправку комментариев к новым статьям.",
                    "type": "string"
                }
            }
        }
    ],
    "schema": {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "title": "settings",
        "type": "object",
        "properties": {
            "title": {
                "type": "string",
                "description": "Название сайта.",
                "default": null
            },
            "description": {
                "type": "string",
                "description": "Слоган сайта.",
                "default": null
            },
            "url": {
                "type": "string",
                "description": "Адрес сайта (URL)",
                "default": null,
                "format": "uri"
            },
            "email": {
                "type": "string",
                "description": "Этот адрес используется в целях администрирования. Например, для уведомления о новых пользователях.",
                "default": null,
                "format": "email"
            },
            "timezone": {
                "type": "string",
                "description": "Город в той же временной зоне что и у вас.",
                "default": null
            },
            "date_format": {
                "type": "string",
                "description": "Общий формат даты.",
                "default": null
            },
            "time_format": {
                "type": "string",
                "description": "Общий формат времени.",
                "default": null
            },
            "start_of_week": {
                "type": "integer",
                "description": "Первый день недели.",
                "default": null
            },
            "language": {
                "type": "string",
                "description": "Код локали WordPress.",
                "default": "en_US"
            },
            "use_smilies": {
                "type": "boolean",
                "description": "Преобразовывать смайлики наподобие :-) и :-P в картинки при показе.",
                "default": true
            },
            "default_category": {
                "type": "integer",
                "description": "Рубрика для записей по умолчанию.",
                "default": null
            },
            "default_post_format": {
                "type": "string",
                "description": "Формат записей по умолчанию.",
                "default": null
            },
            "posts_per_page": {
                "type": "integer",
                "description": "Максимум страниц блога для показа.",
                "default": 10
            },
            "default_ping_status": {
                "type": "string",
                "description": "Разрешить ссылки оповещения с других блогов (уведомления и обратные ссылки) на новые статьи.",
                "default": null,
                "enum": [
                    "open",
                    "closed"
                ]
            },
            "default_comment_status": {
                "type": "string",
                "description": "Разрешить отправку комментариев к новым статьям.",
                "default": null,
                "enum": [
                    "open",
                    "closed"
                ]
            }
        }
    },
    "_links": {
        "self": "http://wptest.ru/wp-json/wp/v2/settings"
    }
}

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"
}