• Hi All,

    Wondering if anyone can give me a clue as to how WordPress handles keeping track of user sessions?

    A simple search through the codebase for things like session_start() or $_SESSION[‘etc’] = ‘thing’ doesn’t appear to show that what I would think of as ‘normal’ session handling is taking place.

    Many thanks,

    pt

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    WordPress does not use sessions in any way at all.

    Thread Starter planetthoughtful

    (@planetthoughtful)

    Hi Otto42,

    Thanks for the reply. Then, do you have any idea how WordPress maintains state across pages?

    Is it essentially through cookies rather than sessions, or some other method?

    Many thanks,

    pt

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    WordPress does not have any states to maintain across pages that I am aware of. It’s stateless in all cases that I can think of. The only case that’s really close is where you activate a plugin or something and a message is displayed on the next screen. This is done by redirection to a url with an extra get variable passed along.

    The cookies are basically an authentication cookie, saying who you are. They don’t contain any other information than your username and a form of proof that you knew the password at some point in time.

    shmichael

    (@shmichael)

    Are there any guidelines concerning use of sessions, in case I require it in my plugin? I wasn’t able to find any resources. (All I found is this forum post)

    PLease use this; works fine in my plugins or other custom fucntions

    <?php
    if ( !session_id() )
    	session_start();

    Hi,

    Refer this plugin:

    https://www.ads-software.com/extend/plugins/session-manager/

    Thanks,

    Shane G.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How does WordPress handle sessions and session variables?’ is closed to new replies.