WP_HTTP_Requests_Response::header()
Sets a single HTTP header.
Метод класса: WP_HTTP_Requests_Response{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$WP_HTTP_Requests_Response = new WP_HTTP_Requests_Response(); $WP_HTTP_Requests_Response->header( $key, $value, $replace );
- $key(строка) (обязательный)
- Header name.
- $value(строка) (обязательный)
- Header value.
- $replace(true|false)
- Whether to replace an existing header of the same name.
По умолчанию: true
Список изменений
С версии 4.6.0 | Введена. |
Код WP_HTTP_Requests_Response::header() WP HTTP Requests Response::header WP 6.7.2
public function header( $key, $value, $replace = true ) { if ( $replace ) { unset( $this->response->headers[ $key ] ); } $this->response->headers[ $key ] = $value; }