HTTP/2 301
server: nginx
date: Fri, 26 Dec 2025 22:10:46 GMT
content-type: text/html; charset=UTF-8
x-olaf: ⛄
vary: accept, content-type
x-redirect-by: WordPress
location: https://developer.wordpress.org/reference/functions/wp_get_http_headers/
x-frame-options: SAMEORIGIN
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 1
HTTP/2 200
server: nginx
date: Fri, 26 Dec 2025 22:10:46 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-olaf: ⛄
vary: accept, content-type
link:
; rel="https://api.w.org/"
link:
; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
x-frame-options: SAMEORIGIN
content-encoding: gzip
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 1
wp_get_http_headers() – Function | Developer.WordPress.org
wp_get_http_headers( string $url, bool $deprecated = false ): WpOrgRequestsUtilityCaseInsensitiveDictionary|false
Retrieves HTTP Headers from URL.
$urlstringrequiredURL to retrieve HTTP headers from.
$deprecatedbooloptionalNot Used.
Default:false
WpOrgRequestsUtilityCaseInsensitiveDictionary|false Headers on success, false on failure.
function wp_get_http_headers( $url, $deprecated = false ) {
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '2.7.0' );
}
$response = wp_safe_remote_head( $url );
if ( is_wp_error( $response ) ) {
return false;
}
return wp_remote_retrieve_headers( $response );
}
View all references View on Trac View on GitHub
| Version | Description |
|---|
| 1.5.1 | Introduced. |
Use the returned class’ (WpOrgRequestsUtilityCaseInsensitiveDictionary) methods to get usable data:
Array
(
[server] => nginx
[date] => Sat, 09 Sep 2023 04:27:52 GMT
[content-type] => text/html; charset=UTF-8
[vary] => Accept-Encoding
[strict-transport-security] => max-age=3600
[x-olaf] => ⛄[link] => Array
(
[0] => ; rel=”https://api.w.org/”
[1] => ; rel=”alternate”; type=”application/json”
[2] => ; rel=shortlink
)
[x-frame-options] => SAMEORIGIN
[content-encoding] => gzip
[x-nc] => EXPIRED ord 1
)
nginx