WP_REST_Request::is_method()publicWP 6.8.0

Determines if the request is the given method.

Method of the class: WP_REST_Request{}

No Hooks.

Return

true|false. Whether the request is of the given method.

Usage

$WP_REST_Request = new WP_REST_Request();
$WP_REST_Request->is_method( $method );
$method(string) (required)
HTTP method.

Changelog

Since 6.8.0 Introduced.

WP_REST_Request::is_method() code WP 6.8

public function is_method( $method ) {
	return $this->get_method() === strtoupper( $method );
}