Uses
Uses | Description |
---|---|
wp-includes/class-wp-http-cookie.php: WP_Http_Cookie::__construct() | Sets up this cookie object. |
Takes the arguments for a ::request() and checks for the cookie array.
If it’s found, then it upgrades any basic name => value pairs to WP_Http_Cookie instances, which are each parsed into strings and added to the Cookie: header (within the arguments array). Edits the array by reference.
(array) (Required) Full array of args passed into ::request()
File: wp-includes/class-http.php
public static function buildCookieHeader( &$r ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid if ( ! empty( $r['cookies'] ) ) { // Upgrade any name => value cookie pairs to WP_HTTP_Cookie instances. foreach ( $r['cookies'] as $name => $value ) { if ( ! is_object( $value ) ) { $r['cookies'][ $name ] = new WP_Http_Cookie( array( 'name' => $name, 'value' => $value, ) ); } } $cookies_header = ''; foreach ( (array) $r['cookies'] as $cookie ) { $cookies_header .= $cookie->getHeaderValue() . '; '; } $cookies_header = substr( $cookies_header, 0, -2 ); $r['headers']['cookie'] = $cookies_header; } }
Version | Description |
---|---|
2.8.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_http/buildcookieheader