WP_Http::normalize_cookies( array $cookies )

Normalizes cookies for using in Requests.


Description Description


Parameters Parameters

$cookies

(array) (Required) Array of cookies to send with the request.


Top ↑

Return Return

(Requests_Cookie_Jar) Cookie holder object.


Top ↑

Source Source

File: wp-includes/class-http.php

	public static function normalize_cookies( $cookies ) {
		$cookie_jar = new Requests_Cookie_Jar();

		foreach ( $cookies as $name => $value ) {
			if ( $value instanceof WP_Http_Cookie ) {
				$cookie_jar[ $value->name ] = new Requests_Cookie( $value->name, $value->value, $value->get_attributes(), array( 'host-only' => $value->host_only ) );
			} elseif ( is_scalar( $value ) ) {
				$cookie_jar[ $name ] = new Requests_Cookie( $name, $value );
			}
		}

		return $cookie_jar;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
4.6.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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