WP_REST_Request::__construct()publicWP 4.4.0

Constructor.

Method of the class: WP_REST_Request{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_REST_Request = new WP_REST_Request();
$WP_REST_Request->__construct( $method, $route, $attributes );
$method(string)
Request method.
Default: ''
$route(string)
Request route.
Default: ''
$attributes(array)
Request attributes.
Default: empty array

Changelog

Since 4.4.0 Introduced.

WP_REST_Request::__construct() code WP 6.4.3

public function __construct( $method = '', $route = '', $attributes = array() ) {
	$this->params = array(
		'URL'      => array(),
		'GET'      => array(),
		'POST'     => array(),
		'FILES'    => array(),

		// See parse_json_params.
		'JSON'     => null,

		'defaults' => array(),
	);

	$this->set_method( $method );
	$this->set_route( $route );
	$this->set_attributes( $attributes );
}