WP_REST_Request::set_header( string $key, string $value )

In this article

Sets the header on request.

Parameters

$keystringrequired
Header name.
$valuestringrequired
Header value, or list of values.

Source

public function set_header( $key, $value ) {
	$key   = $this->canonicalize_header_name( $key );
	$value = (array) $value;

	$this->headers[ $key ] = $value;
}

Changelog

VersionDescription
4.4.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.