W3cubDocs

/WordPress

rest_do_request( WP_REST_Request|string $request )

Do a REST request.

Description

Used primarily to route internal requests through WP_REST_Server.

Parameters

$request

(WP_REST_Request|string) (Required) Request.

Return

(WP_REST_Response) REST response.

Source

File: wp-includes/rest-api.php

function rest_do_request( $request ) {
	$request = rest_ensure_request( $request );
	return rest_get_server()->dispatch( $request );
}

Changelog

Version Description
4.4.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/rest_do_request