rest_do_request() WordPress Function

The rest_do_request() function is used to make an HTTP request to a WordPress REST API endpoint. This function is used internally by the WordPress REST API to make requests to registered endpoints.

rest_do_request( WP_REST_Request|string $request ) #

Do a REST request.


Description

Used primarily to route internal requests through WP_REST_Server.


Top ↑

Parameters

$request

(WP_REST_Request|string)(Required)Request.


Top ↑

Return

(WP_REST_Response) REST response.


Top ↑

Source

File: wp-includes/rest-api.php

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


Top ↑

Changelog

Changelog
VersionDescription
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More