wordpress / latest / classes / wp_rest_request / __construct.html

WP_REST_Request::__construct( string $method = '', string $route = '', array $attributes = array() )

Constructor.

Parameters

$method string Optional
Request method.

Default: ''

$route string Optional
Request route.

Default: ''

$attributes array Optional
Request attributes.

Default: array()

Source

File: wp-includes/rest-api/class-wp-rest-request.php. View all references

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 );
}

Used By

Used By Description

Changelog

Version Description
4.4.0 Introduced.

© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_request/__construct