WP_Http_Cookie::__construct

SummerySummery

Sets up this cookie object.

Syntax

WP_Http_Cookie::__construct( string|array $data, string $requested_url = '' )

DescriptionDescription

The parameter $data should be either an associative array containing the indices names below or a header string detailing it.

ParametersParameters

$data

(string|array) (Required) Raw cookie data as header string or data array.

  • 'name'
    (string) Cookie name.
  • 'value'
    (mixed) Value. Should NOT already be urlencoded.
  • 'expires'
    (string|int|null) Optional. Unix timestamp or formatted date. Default null.
  • 'path'
    (string) Optional. Path. Default '/'.
  • 'domain'
    (string) Optional. Domain. Default host of parsed $requested_url.
  • 'port'
    (int) Optional. Port. Default null.
  • 'host_only'
    (bool) Optional. host-only storage flag. Default true.

$requested_url

(string) (Optional) The URL which the cookie was set on, used for default $domain and $port values.

Default value: ''

SourceSource

File: wp-includes/class-wp-http-cookie.php


			

ChangelogChangelog

Changelog
Version Description
5.2.0 Added host_only to the $data parameter.
2.8.0 Introduced.
Scroll to Top