On this page
wp_get_http_headers( string $url, bool $deprecated = false ): Requests_Utility_CaseInsensitiveDictionary|false
Retrieves HTTP Headers from URL.
Parameters
$urlstring Required-
URL to retrieve HTTP headers from.
$deprecatedbool Optional-
Not Used.
Default:
false
Return
Requests_Utility_CaseInsensitiveDictionary|false Headers on success, false on failure.
Source
File: wp-includes/functions.php. View all references
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 );
}
Related
Uses
| Uses | Description |
|---|---|
| wp_remote_retrieve_headers() wp-includes/http.php | Retrieve only the headers from the raw response. |
| wp_safe_remote_head() wp-includes/http.php | Retrieve the raw response from a safe HTTP request using the HEAD method. |
| _deprecated_argument() wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| is_wp_error() wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
Used By
| Used By | Description |
|---|---|
| do_enclose() wp-includes/functions.php | Checks content for video and audio links to add as enclosures. |
Changelog
| Version | Description |
|---|---|
| 1.5.1 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_get_http_headers