How do you use session variables in wordpress?
php, session, variables, wordpress
Solution
Replace:
global $wp_session;
With:
$wp_session = WP_Session::get_instance();
Make sure you add `$wp_session = WP_Session::get_instance();` before you try to echo the variable on page 2.
Problem
I have the following plugin: http://wordpress.org/support/plugin/wp-session-manager I cannot work out how to use the session variables in WordPress. From what I understand by reading, this is how it should be used: I have the following on page one (page 1): ``` global $wp_session; $wp_session['loggedIn'] = 15; echo $wp_session['loggedIn']; ``` On the first page, the session variable is working but on the second page, the session variable is not working. Can anyone suggest me where I am going wrong? Thanks.