Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[WordPress] Set Cookies in WordPress
/* Assume all validation and verification of the username has been completed
* and that the username is stored in the $username variable.
* Note also that the DAY_IN_SECONDS is a constant provided by WordPress
* so we're setting the cookie for one week.
setcookie( 'acme_username', $username, time() + ( 7 * DAY_IN_SECONDS ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.