wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_remote_retrieve_header › WordPress Function

Since2.7.0
Deprecatedn/a
wp_remote_retrieve_header ( $response, $header )
Parameters: (2)
  • (array|WP_Error) $response HTTP response.
    Required: Yes
  • (string) $header Header name to retrieve value from.
    Required: Yes
Returns:
  • (array|string) The header(s) value(s). Array if multiple headers with the same name are retrieved. Empty string if incorrect parameter given, or if the header doesn't exist.
Defined at:
Codex:

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