WP_HTTP_Requests_Response::header( string $key, string $value, bool $replace = true )

Sets a single HTTP header.

Description Description

Parameters Parameters


(string) (Required) Header name.


(string) (Required) Header value.


(bool) (Optional) Whether to replace an existing header of the same name.

Default value: true

Top ↑

Source Source

File: wp-includes/class-wp-http-requests-response.php

	public function header( $key, $value, $replace = true ) {
		if ( $replace ) {
			unset( $this->response->headers[ $key ] );

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

Top ↑

Changelog Changelog

Version Description
4.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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