WP_REST_Request::set_body()publicWP 4.4.0

Sets body content.

Method of the class: WP_REST_Request{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_REST_Request = new WP_REST_Request();
$WP_REST_Request->set_body( $data );
$data(string) (required)
Binary data from the request body.

Changelog

Since 4.4.0 Introduced.

WP_REST_Request::set_body() code WP 6.5.2

public function set_body( $data ) {
	$this->body = $data;

	// Enable lazy parsing.
	$this->parsed_json    = false;
	$this->parsed_body    = false;
	$this->params['JSON'] = null;
}