Title: wp_remote_retrieve_cookies
Published: December 9, 2015
Last modified: August 20, 2026

---

# wp_remote_retrieve_cookies( array|WP_Error $response ): 󠀁[WP_Http_Cookie](https://developer.wordpress.org/reference/classes/wp_http_cookie/)󠁿[]

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_cookies/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_cookies/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_cookies/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_cookies/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_cookies/?output_format=md#changelog)

Retrieves only the cookies from the raw response.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_cookies/?output_format=md#parameters)󠁿

 `$response`array|[WP_Error](https://developer.wordpress.org/reference/classes/wp_error/)
required

HTTP response.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_cookies/?output_format=md#return)󠁿

 [WP_Http_Cookie](https://developer.wordpress.org/reference/classes/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](https://developer.wordpress.org/reference/classes/wp_error/).

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_cookies/?output_format=md#source)󠁿

    ```php
    function wp_remote_retrieve_cookies( $response ) {
    	if ( is_wp_error( $response ) || empty( $response['cookies'] ) ) {
    		return array();
    	}

    	return $response['cookies'];
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/http.php#L333)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/http.php#L333-L339)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_cookies/?output_format=md#related)󠁿

| Uses | Description | 
| [is_wp_error()](https://developer.wordpress.org/reference/functions/is_wp_error/)`wp-includes/load.php` |

Checks whether the given variable is a WordPress Error.

  |

| Used by | Description | 
| [wp_remote_retrieve_cookie()](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_cookie/)`wp-includes/http.php` |

Retrieves a single cookie by name from the raw response.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_cookies/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_remote_retrieve_cookies%2F)
before being able to contribute a note or feedback.