wppaste
WordPress

WP_Http_Cookie

Since
2.8.0
Source
wp-includes/class-wp-http-cookie.php:21
Core class used to encapsulate a single cookie object for internal use.

Description

Returned cookies are represented using this class, and when cookies are set, if they are not already a WP_Http_Cookie() object, then they are turned into one.

Compatibility

WordPress
since 2.8.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Hooks and filters fired · 1

Every hook that fires from inside WP_Http_Cookie, in the order it appears in the class, grouped by the method that fires it.

Properties · 7

$namestringpublic
Cookie name.
$valuestringpublic
Cookie value.
$expiresstring|int|nullpublic
When the cookie expires. Unix timestamp or formatted date.
$pathstringpublic
Cookie URL path.
$domainstringpublic
Cookie Domain.
$portint|stringpublic
Cookie port or comma-separated list of ports.
$host_onlyboolpublic
host-only flag.

Methods · 5

Source code

#[AllowDynamicProperties]class WP_Http_Cookie { 	/**	 * Cookie name.	 *	 * @since 2.8.0	 *	 * @var string	 */	public $name; 	/**	 * Cookie value.	 *	 * @since 2.8.0	 *	 * @var string	 */	public $value; 	/**	 * When the cookie expires. Unix timestamp or formatted date.	 *	 * @since 2.8.0	 *	 * @var string|int|null	 */	public $expires; 	/**	 * Cookie URL path.	 *	 * @since 2.8.0	 *	 * @var string	 */	public $path; 	/**	 * Cookie Domain.	 *	 * @since 2.8.0	 *	 * @var string	 */	public $domain; 	/**	 * Cookie port or comma-separated list of ports.	 *	 * @since 2.8.0	 *	 * @var int|string	 */	public $port; 	/**	 * host-only flag.	 *	 * @since 5.2.0	 *	 * @var bool	 */	public $host_only; 	/**	 * Sets up this cookie object.	 *	 * The parameter $data should be either an associative array containing the indices names below	 * or a header string detailing it.	 *	 * @since 2.8.0	 * @since 5.2.0 Added `host_only` to the `$data` parameter.	 *	 * @param string|array $data {	 *     Raw cookie data as header string or data array.	 *	 *     @type string          $name      Cookie name.	 *     @type mixed           $value     Value. Should NOT already be urlencoded.

Changelog

Introduced in 2.8.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 tag, from src/wp-includes/class-wp-http-cookie.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.