wp_get_http_headers() WordPress Function
The wp_get_http_headers() function is used to get the headers for a given URL. This is useful for debugging purposes or for checking the status of a given URL.
wp_get_http_headers( string $url, bool $deprecated = false ) #
Retrieve HTTP Headers from URL.
Parameters
- $url
(string)(Required)URL to retrieve HTTP headers from.
- $deprecated
(bool)(Optional)Not Used.
Default value: false
Return
(string|false) Headers on success, false on failure.
Source
File: wp-includes/functions.php
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 ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
1.5.1 | Introduced. |