WordPress at a glance
Home All Function Functions APIs HTTP API

wp_remote_retrieve_header() WP 1.0

Retrieve a single header by name from the raw response.

No Hooks.


String. The header value. Empty string on if incorrect parameter given, or if the header doesn't exist.


wp_remote_retrieve_header( $response, $header );
$response(array/WP_Error) (required)
HTTP response.
$header(string) (required)
Header name to retrieve value from.


Since 2.7.0 Introduced.

Code of wp remote retrieve header: wp-includes/http.php WP 5.4.2

function wp_remote_retrieve_header( $response, $header ) {
	if ( is_wp_error( $response ) || ! isset( $response['headers'] ) ) {
		return '';

	if ( isset( $response['headers'][ $header ] ) ) {
		return $response['headers'][ $header ];

	return '';

Related Functions

From tag: HTTP API (curl remote)

No comments
        Log In . Register