• Resolved azibux1

    (@azibux1)


    Hi,

    I have the following plugin: https://www.ads-software.com/support/plugin/wp-session-manager

    But cannot work out how to use session variables in WordPress. From what I can work out by reading how it should be done with the plugin, I have the following one one page (page 1):

    gloabl $wp_session;
    $wp_session['loggedIn'] = 15;
    
    echo $wp_session['loggedIn'];

    Which echos out 15

    But on another page (page 2) if I have

    echo $wp_session['loggedIn'];

    Then first going to page 1, then page 2, on page 2 nothing is echoed out, it seems to only work on the page that I set the variable on, and then gets lost when I change page

    Anybody know what I’m missing please?

Viewing 1 replies (of 1 total)
  • Thread Starter azibux1

    (@azibux1)

    Sorted it with help from StackOverflow

    Needed to replace the global … with $wp_session = WP_Session::get_instance();

Viewing 1 replies (of 1 total)
  • The topic ‘Session variables in wordpress? How do you use them’ is closed to new replies.