wp_remote_retrieve_cookie_value

The timeline below displays how wordpress function wp_remote_retrieve_cookie_value has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.4

/**
 * Retrieve a single cookie's value by name from the raw response.
 *
 * @since 4.4.0
 *
 * @param array|WP_Error $response HTTP response.
 * @param string         $name     The name of the cookie to retrieve.
 * @return string The value of the cookie, or empty string
 *                if the cookie is not present in the response.
 */
function wp_remote_retrieve_cookie_value($response, $name)
{
    $cookie = wp_remote_retrieve_cookie($response, $name);
    if (!$cookie instanceof WP_Http_Cookie) {
        return '';
    }
    return $cookie->value;
}

WordPress Version: 6.1

/**
 * Retrieve a single cookie's value by name from the raw response.
 *
 * @since 4.4.0
 *
 * @param array|WP_Error $response HTTP response.
 * @param string         $name     The name of the cookie to retrieve.
 * @return string The value of the cookie, or empty string
 *                if the cookie is not present in the response.
 */
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;
}

WordPress Version: 5.3

/**
 * Retrieve a single cookie's value by name from the raw response.
 *
 * @since 4.4.0
 *
 * @param array|WP_Error $response HTTP response.
 * @param string         $name     The name of the cookie to retrieve.
 * @return string The value of the cookie. Empty string if the cookie isn't present in the response.
 */
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;
}

WordPress Version: 4.4

/**
 * Retrieve a single cookie's value by name from the raw response.
 *
 * @since 4.4.0
 *
 * @param array  $response HTTP response.
 * @param string $name     The name of the cookie to retrieve.
 * @return string The value of the cookie. Empty string if the cookie isn't present in the response.
 */
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;
}