On this page
WP_REST_Request::__construct( string $method = '', string $route = '', array $attributes = array() )
Constructor.
Parameters
$methodstring Optional-
Request method.
Default:
'' $routestring Optional-
Request route.
Default:
'' $attributesarray 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 );
}
Related
Uses
| Uses | Description |
|---|---|
| WP_REST_Request::set_attributes() wp-includes/rest-api/class-wp-rest-request.php | Sets the attributes for the request. |
| WP_REST_Request::set_route() wp-includes/rest-api/class-wp-rest-request.php | Sets the route that matched the request. |
| WP_REST_Request::set_method() wp-includes/rest-api/class-wp-rest-request.php | Sets HTTP method for the request. |
Used By
| Used By | Description |
|---|---|
| _register_remote_theme_patterns() wp-includes/block-patterns.php | Registers patterns from Pattern Directory provided by a theme’s |
| _load_remote_featured_patterns() wp-includes/block-patterns.php | Register |
| _load_remote_block_patterns() wp-includes/block-patterns.php | Register Core’s official patterns from wordpress.org/patterns. |
| WP_REST_Server::serve_batch_request_v1() wp-includes/rest-api/class-wp-rest-server.php | Serves the batch/v1 request. |
| rest_preload_api_request() wp-includes/rest-api.php | Append result of internal request to REST API for purpose of preloading data to be attached to a page. |
| WP_REST_Request::from_url() wp-includes/rest-api/class-wp-rest-request.php | Retrieves a WP_REST_Request object from a full URL. |
| rest_ensure_request() wp-includes/rest-api.php | Ensures request arguments are a request object (for consistency). |
| WP_REST_Server::serve_request() wp-includes/rest-api/class-wp-rest-server.php | Handles serving a REST API request. |
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