WP_REST_Request::set_headers( array $headers, bool $override = true )

Sets headers on the request.


Description Description


Parameters Parameters

$headers

(array) (Required) Map of header name to value.

$override

(bool) (Optional) If true, replace the request's headers. Otherwise, merge with existing.

Default value: true


Top ↑

Source Source

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

	public function set_headers( $headers, $override = true ) {
		if ( true === $override ) {
			$this->headers = array();
		}

		foreach ( $headers as $key => $value ) {
			$this->set_header( $key, $value );
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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