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
$_SESSION
variable in PHP, one should havesession_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$_COOKIE
variable. Read more about PHP cookies.
That’s all for now. Hopefully, I’ll spend less time bumping my head over this next time.
Leonid, the funny part is that I was bumping my head on Monday and Tuesday because of cookies and sessions. ROFL, this is such a crazy world!
LOL.. with all the things people can be doing – they stick to the same old stuff. :)