Uses
Uses | Description |
---|---|
wp-includes/rest-api/class-wp-rest-request.php: WP_REST_Request::__construct() | Constructor. |
Ensures request arguments are a request object (for consistency).
(array|string|WP_REST_Request) (Required) Request to check.
(WP_REST_Request) REST request instance.
File: wp-includes/rest-api.php
function rest_ensure_request( $request ) { if ( $request instanceof WP_REST_Request ) { return $request; } if ( is_string( $request ) ) { return new WP_REST_Request( 'GET', $request ); } return new WP_REST_Request( 'GET', '', $request ); }
Version | Description |
---|---|
5.3.0 | Accept string argument for the request path. |
4.4.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/rest_ensure_request