WP_REST_Request::set_method() WordPress Method

The set_method() method is used to set the request method for a given request. This is useful for specifying a different request method than the default.

WP_REST_Request::set_method( string $method ) #

Sets HTTP method for the request.


Parameters

$method

(string)(Required)HTTP method.


Top ↑

Source

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

	public function set_method( $method ) {
		$this->method = strtoupper( $method );
	}


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.