WP_HTTP_Response::header( string $key, string $value, bool $replace = true )
Sets a single HTTP header.
Parameters
- $key
-
(string) (Required) Header name.
- $value
-
(string) (Required) Header value.
- $replace
-
(bool) (Optional) Whether to replace an existing header of the same name.
Default value: true
Source
File: wp-includes/class-wp-http-response.php
public function header( $key, $value, $replace = true ) { if ( $replace || ! isset( $this->headers[ $key ] ) ) { $this->headers[ $key ] = $value; } else { $this->headers[ $key ] .= ', ' . $value; } }
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_http_response/header