Do a REST request.
Description
Used primarily to route internal requests through WP_REST_Server.
Parameters
$request
WP_REST_Request|stringrequired- Request.
Source
function rest_do_request( $request ) {
$request = rest_ensure_request( $request );
return rest_get_server()->dispatch( $request );
}
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |
rest_do_request
can be used to internally send a REST API request and return the response object for it. You need to create the Request object first.