Forums

Using session variables in wordpress (2.5) (2 posts)

  1. crj18
    Member
    Posted 4 years ago #

    Has anyone had problems using (php) session variables in wordpress 2.5? I was doing it in 2.3 with no issues, but now it seems to maintain a different session for each page.

    The session variables aren't being destroyed, they're still persistent - it's just that for some reason I'm getting a different session (and session id) for each page...however, if I return to a previous page, I do still get the same session id I had last time I was at that page.

    Now the totally weird part: this problem only happens when I click on links between pages...however, if I actually type in the new URL manually, it works fine and the session id and variables are preserved between pages. Sounds crazy, but I've tested it dozens of times.

    Does anyone have any idea how to fix this problem?

    Thanks!

  2. crj18
    Member
    Posted 4 years ago #

    Ah, got it...sort of. There were actually only 2 sessions being set - one was for domain.com and the other was http://www.domain.com. I'm not really sure why because none of my URLs have the www in them, but somehow wordpress 2.5 was associating some pages with www. I added the redirection plugin and set it to strip www from all pages and that seemed to fix the problem.

    I still have no idea why it made a difference when I typed in the URL manually vs clicking on a link, or why the problem exists in WP 2.5 but not WP 2.3, but it's fixed now anyway... :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags