wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



wp_remote_retrieve_cookie › WordPress Function

Od4.4.0
Przestarzałyn/a
wp_remote_retrieve_cookie ( $response, $name )
Parametry: (2)
  • (array|WP_Error) $response HTTP response.
    Wymagane: Tak
  • (string) $name The name of the cookie to retrieve.
    Wymagane: Tak
Powrót:
  • (WP_Http_Cookie|string) The `WP_Http_Cookie` object, or empty string if the cookie is not present in the response.
Zdefiniowane na:
Codex:

Retrieve a single cookie by name from the raw response.



Źródło

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