Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_remote_retrieve_cookie ›

Da4.4.0
Deprecaton/a
wp_remote_retrieve_cookie ( $response, $name )
Parametri: (2)
  • (array) $response HTTP response.
    Richiesto:
  • (string) $name The name of the cookie to retrieve.
    Richiesto:
Ritorna:
  • (WP_Http_Cookie|string) The `WP_Http_Cookie` object. Empty string if the cookie isn't present in the response.
Definito a:
Codex:

Retrieve a single cookie by name from the raw response.



Sorgenti

function wp_remote_retrieve_cookie( $response, $name ) {
	$cookies = wp_remote_retrieve_cookies( $response );

	if ( empty( $cookies ) ) {
		return '';
	}

	foreach ( $cookies as $cookie ) {
		if ( $cookie->name === $name ) {
			return $cookie;
		}
	}

	return '';
}