wp_remote_retrieve_cookies( array|WP_Error $response ): WP_Http_Cookie[]

In this article

Retrieves only the cookies from the raw response.

Parameters

$responsearray|WP_Errorrequired
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.

Source

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

	return $response['cookies'];
}

Changelog

VersionDescription
4.4.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.