WordPress at Your Fingertips
function is not described

WP_HTTP_Requests_Response::header() public WP 4.6.0

Sets a single HTTP header.

{} It's a method of the class: WP_HTTP_Requests_Response{}

No Hooks.


null. Nothing.


$WP_HTTP_Requests_Response = new WP_HTTP_Requests_Response();
$WP_HTTP_Requests_Response->header( $key, $value, $replace );
$key(string) (required)
Header name.
$value(string) (required)
Header value.
Whether to replace an existing header of the same name.
Default: true

Code of WP_HTTP_Requests_Response::header() WP 5.8.3

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

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