Add the following code under the top PHP opening tag of wp-config.php.
<?php
if (!session_id()) {
session_start();
}
...
We can now make use of the $_SESSION[] in WordPress. The reason of putting the session_start() in wp-config.php is because this configuration file will not be overwritten during a WordPress update.
Thanks Frank Verhoeven.
Done =)
Reference: Frank Verhoeven – Using Sessions in WordPress
Updated @ 2012-08-02: Please note that their maybe security issue of using the PHP session. For more information, please refer to the following link.
PHP $_SESSION variables