Constructor.
Parameters
$method
stringoptional- Request method.
Default:
''
$route
stringoptional- Request route.
Default:
''
$attributes
arrayoptional- Request attributes.
Default:
array()
Source
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 );
}
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |
Request objects can also be constructed from a URL by using
WP_REST_Request::from_url
: