A WordPress-centric search engine for devs and theme authors



wp_remote_retrieve_header ›

Since2.7.0
Deprecatedn/a
wp_remote_retrieve_header ( $response, $header )
Parameters: (2)
  • (array) $response
    Required: Yes
  • (string) $header Header name to retrieve value from.
    Required: Yes
Returns:
  • (string) The header value. Empty string on if incorrect parameter given, or if the header doesn't exist.
Defined at:
Codex:

Retrieve a single header by name from the raw response.



Source

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