Blog of Leonid Mamchenkov

You just stepped in a pile of posts.

WordPress and PHP. Sessions and cookies.

Posted in All on March 6th, 2007 · 2 Comments

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 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 $_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.

Tags:

2 responses so far ↓

  • 1 Timur Asaliev // Mar 7, 2007 at 12:34 pm

    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!

  • 2 Leonid Mamchenkov // Mar 7, 2007 at 12:50 pm

    LOL.. with all the things people can be doing - they stick to the same old stuff. :)

Leave a Comment

Note: This post is over a year and a half old. You may want to check later in this blog to see if there is new information relevant to your comment.