llms_setcookie( string $name, string $value = '', int $expires, string $path = '', string $domain = '', bool $secure = false, bool $httponly = false )

Set a cookie.

Description Description

A pluggable wrapper for the native PHP function set_cookie().

The lifterlms-tests library plugs this function during unit testing so we can mock the returns of methods that set cookies and write tests for those functions.

Top ↑

Parameters Parameters


(string) (Required) The name of the cookie.


(string) (Optional) The value of the cookie.

Default value: ''


(int) (Required) The time wehn the cookie expires as a Unix timestamp.


(string) (Optional) The path on the server where the cookie will be available.

Default value: ''


(string) (Optional) The (sub)domain that the cookie is available to.

Default value: ''


(bool) (Optional) Indicates the cookie should only be transmitted over a secure HTTPS connection.

Default value: false


(bool) (Optional) When true the cookie will only be made accessible through the HTTP protocol, preventing it from being accessed by scripting languages (such as Javascript).

Default value: false

Top ↑

Return Return


Top ↑

Source Source

File: includes/functions/llms-functions-wrappers.php

	function llms_setcookie( $name, $value = '', $expires = 0, $path = '', $domain = '', $secure = false, $httponly = false ) {
		return setcookie( $name, $value, $expires, $path, $domain, $secure, $httponly );

Top ↑

Changelog Changelog

Version Description
5.3.0 Moved location from includes/llms.functions.core.php.
4.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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