WP_REST_Request::set_body() WordPress Method

The WP_REST_Request::set_body() method sets the body of the request. This is useful for setting the body of a POST or PUT request.

WP_REST_Request::set_body( string $data ) #

Sets body content.


Parameters

$data

(string)(Required)Binary data from the request body.


Top ↑

Source

File: wp-includes/rest-api/class-wp-rest-request.php

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

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

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.