I have developed a website in codeigniter and integrated wordpress for blog. My problem is if i logged in the site, i am not able to use the codeigniter session value in the wordpress blog.
In Codeigniter once i logged in i am setting the following session using codeigniter session.
$this->session->set_userdata('get_user_session', $auD);
Now i need to use the session in wordpress header file or index file. I tried the below code in wordpress.
session_start();
print_r($_SESSION);
I am not getting the above ci session values.
CodeIgniter’s Session class:
>> stores session information for each user as serialized (and optionally encrypted) data in a cookie
.The values you set using
$this->session->set_userdata('key','value')
are not going to be present in the$_SESSION
variable.CodeIgniter also supports storing session content in a database.
You can use that configuration to retrieve the session data in your WordPress blog.
Use COOKIES to get the session data.
Refer this link: https://thomashunter.name/blog/accessing-codeigniter-session-data-using-external-scripts/
I use the following code in wp-config.php and works for me.
Store session in Codeigniter in DB.
Codeigniter version 3.x.x