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[\d]+) This endpoint is used to update a specific setting for the site. DELETE /wp-json/wp/v2/settings/(?P[\d]+) This endpoint is used to delete a specific setting for the site.

WP_REST_Settings_Controller::register_routes() #

Registers the routes for the site’s settings.


Description

Top ↑

See also


Top ↑

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' ),
			)
		);

	}


Top ↑

Changelog

Changelog
VersionDescription
4.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.