Add this to you functions.php
add_action('init', 'myStartSession', 1); //Initialize session add_action('wp_logout', 'myEndSession'); //End session on logout add_action('wp_login', 'myEndSession'); //End session on account change function myStartSession() { if(!session_id()) { session_start(); } } function myEndSession() { session_destroy (); }
Access the value in normal PHP fashion
$_SESSION['myKey'] = "Some data I need later";
Source: https://silvermapleweb.com/using-the-php-session-in-wordpress/