PHP Developers Network
http://forums.devnetwork.net/

Custom Session in wordpress
http://forums.devnetwork.net/viewtopic.php?f=1&t=142729
Page 1 of 1

Author:  vishalp [ Tue Jul 05, 2016 4:40 am ]
Post subject:  Custom Session in wordpress

Hello ,
i am trying to set session in theme so i have added code in header.php file of theme folder. when we set session it works but after refresh the page,it destroy. I have changed in load.php file by adding '_session' in wp_unregister_GLOBALS() function. I don't know what it going wrong. :( My code is as follows:

Syntax: [ Download ] [ Hide ]
session_start();
if($_SESSION['usersubdomain']){
echo "Session Set ".$_SESSION['usersubdomain'];
}
else{
echo "Session is not Set ";
$_SESSION['usersubdomain']="Check Session";
}


each and every time it echos "session is not set";

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/