wp_remote_retrieve_cookies

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

WordPress Version: 6.1

/**
 * Retrieve only the cookies from the raw response.
 *
 * @since 4.4.0
 *
 * @param array|WP_Error $response HTTP response.
 * @return WP_Http_Cookie[] An array of `WP_Http_Cookie` objects from the response.
 *                          Empty array if there are none, or the response is a WP_Error.
 */
function wp_remote_retrieve_cookies($response)
{
    if (is_wp_error($response) || empty($response['cookies'])) {
        return array();
    }
    return $response['cookies'];
}

WordPress Version: 5.3

/**
 * Retrieve only the cookies from the raw response.
 *
 * @since 4.4.0
 *
 * @param array|WP_Error $response HTTP response.
 * @return WP_Http_Cookie[] An array of `WP_Http_Cookie` objects from the response. Empty array if there are none, or the response is a WP_Error.
 */
function wp_remote_retrieve_cookies($response)
{
    if (is_wp_error($response) || empty($response['cookies'])) {
        return array();
    }
    return $response['cookies'];
}

WordPress Version: 4.5

/**
 * Retrieve only the cookies from the raw response.
 *
 * @since 4.4.0
 *
 * @param array $response HTTP response.
 * @return array An array of `WP_Http_Cookie` objects from the response. Empty array if there are none, or the response is a WP_Error.
 */
function wp_remote_retrieve_cookies($response)
{
    if (is_wp_error($response) || empty($response['cookies'])) {
        return array();
    }
    return $response['cookies'];
}

WordPress Version: 4.4

/**
 * Retrieve only the body from the raw response.
 *
 * @since 4.4.0
 *
 * @param array $response HTTP response.
 * @return array An array of `WP_Http_Cookie` objects from the response. Empty array if there are none, or the response is a WP_Error.
 */
function wp_remote_retrieve_cookies($response)
{
    if (is_wp_error($response) || empty($response['cookies'])) {
        return array();
    }
    return $response['cookies'];
}