Php session not working in wordpress page template

I have used session_start() in two templates of my wordpress site. In local server the i can able to use session variable in both the templates.
But in live server i am unable to retrieve the session value. It shows blank array when i use
print_r($_SESSION)

Thank You

Related posts

Leave a Reply

2 comments

  1. WordPress will allow only these Variables:-

    'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES'
    

    wp_unregister_GLOBALS this function will reset your SESSION for some security reason. you can find this function in WordPress Package (File:- wp-includes/load.php)

    You can find Documents Here.

    So, If you want to use SESSION than you need to use plugin for allow SESSION variable to use.

    Hope it will help you.