W3cubDocs

/WordPress

Cookie::uri_matches( WpOrgRequestsIri $uri ): boolean

Check if a cookie is valid for a given URI

Parameters

$uriWpOrgRequestsIrirequired
URI to check

Return

boolean Whether the cookie is valid for the given URI

Source

public function uri_matches(Iri $uri) {
	if (!$this->domain_matches($uri->host)) {
		return false;
	}

	if (!$this->path_matches($uri->path)) {
		return false;
	}

	return empty($this->attributes['secure']) || $uri->scheme === 'https';
}

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wporg-requests-cookie/uri_matches