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

In this article

Sets a single HTTP header.

Parameters

$keystringrequired
Header name.
$valuestringrequired
Header value.
$replacebooloptional
Whether to replace an existing header of the same name.

Default:true

Source

public function header( $key, $value, $replace = true ) {
	if ( $replace || ! isset( $this->headers[ $key ] ) ) {
		$this->headers[ $key ] = $value;
	} else {
		$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.