wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



wp_remote_retrieve_header › WordPress Function

Depuis2.7.0
Dépréciéen/a
wp_remote_retrieve_header ( $response, $header )
Paramètres: (2)
  • (array|WP_Error) $response HTTP response.
    Requis: Oui
  • (string) $header Header name to retrieve value from.
    Requis: Oui
Retourne:
  • (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.
Défini(e) dans:
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 '';
}