So in order to activate session variables within your WordPress installation the only thing you have to do is call session_start(); before any output is send to the client. Normally upgrading your WordPress installation will replace all files, so we will want to install the code within our site theme to avoid the changes from being lost.
We will add the next lines of code to our functions.php file within our theme:
if ( !session_id() ) add_action( 'init', 'session_start' );
It is best place to add these lines is at the top of functions.php, immediately after the php start tag (<?php).