A WordPress-centric search engine for devs and theme authors



wp_remote_retrieve_cookie_value ›

Since4.4.0
Deprecatedn/a
wp_remote_retrieve_cookie_value ( $response, $name )
Parameters: (2)
  • (array) $response HTTP response.
    Required: Yes
  • (string) $name The name of the cookie to retrieve.
    Required: Yes
Returns:
  • (string) The value of the cookie. Empty string if the cookie isn't present in the response.
Defined at:
Codex:

Retrieve a single cookie's value by name from the raw response.



Source

function wp_remote_retrieve_cookie_value( $response, $name ) {
	$cookie = wp_remote_retrieve_cookie( $response, $name );

	if ( ! is_a( $cookie, 'WP_Http_Cookie' ) ) {
		return '';
	}

	return $cookie->value;
}