Home » , , » Use $_SESSION in WordPress/Woocommerce

Use $_SESSION in WordPress/Woocommerce

Written By Unknown on Minggu, 13 Oktober 2013 | 22.35

By default you cannot create your $_SESSION in WordPress/Woocommerce.
The information in $_SESSION remain in only those files on which it is created.
You cant access $_SESSION on  other file.

So, for creating your own session variable you need to install
WP Session Manager plugin.To download you can visit

http://wordpress.org/plugins/wp-session-manager/

And to use the $_SESSION you need to first create session object.
To create object use below line.

$wp_session = WP_Session::get_instance();

and to set value use

$wp_session['session_name']=array('one'=>'1','two'=>'2');
or
$wp_session['session_name']="Your value";


Note: You have to first create session object on every file where you wish to use $wp_session object.
Share this article :

Posting Komentar

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Kumpulan Kata Broadcast Blackberry - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger