WP_REST_Settings_Controller::register_routes() WordPress Method
The WP_REST_Settings_Controller::register_routes() method is used to register the routes for the settings endpoints. The routes are registered for the following endpoints:
GET /wp-json/wp/v2/settings
This endpoint is used to retrieve the settings for the site.
POST /wp-json/wp/v2/settings
This endpoint is used to update the settings for the site.
PUT /wp-json/wp/v2/settings/(?P
WP_REST_Settings_Controller::register_routes() #
Registers the routes for the site’s settings.
Description
See also
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
public function register_routes() {
register_rest_route(
$this->namespace,
'/' . $this->rest_base,
array(
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_item' ),
'args' => array(),
'permission_callback' => array( $this, 'get_item_permissions_check' ),
),
array(
'methods' => WP_REST_Server::EDITABLE,
'callback' => array( $this, 'update_item' ),
'args' => $this->get_endpoint_args_for_item_schema( WP_REST_Server::EDITABLE ),
'permission_callback' => array( $this, 'get_item_permissions_check' ),
),
'schema' => array( $this, 'get_public_item_schema' ),
)
);
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 4.7.0 | Introduced. |