W3cubDocs

/WordPress

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

(bool|string) False on failure, headers on success.

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 );
}

Changelog

Version Description
1.5.1 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_get_http_headers