Sets a single HTTP header.
(string) (Required) Header name.
(string) (Required) Header value.
(bool) (Optional) Whether to replace an existing header of the same name.
Default value: true
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; }
Version | Description |
---|---|
4.6.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_http_requests_response/header