This is more of a reminder to myself, than anything else.
- WordPress does not use sessions as of now. They do everything via cookies.
- Before using
$_SESSIONvariable in PHP, one should have
session_start()done. Read more about PHP sessions. In WordPress, the best place to have this is at the top of the header.php.
- Another page load is needed after
setcookie()call to be able to use the
$_COOKIEvariable. Read more about PHP cookies.
That’s all for now. Hopefully, I’ll spend less time bumping my head over this next time.