Home » , , » Update value of $wp_session['session_name'] in woocommerce/wordpress

Update value of $wp_session['session_name'] in woocommerce/wordpress

Written By Unknown on Minggu, 13 Oktober 2013 | 23.10

$wp_session = WP_Session::get_instance();
 is method to create your own  session in woocommerce/wordpress.
You can use $wp_session['session_name'] on any file in woocommerce/wordpress
after creating but if you want to change its value you need to first convert this object to array.

For creating array use
$temp = current((array)$wp_session['session_name']);

$temp return you the array / value assigned to $wp_session['session_name']...
Now use or edit $temp as your need and after use assign this array again to $wp_session['session_name']
using

unset ($wp_session['session_name']);
$wp_session['session_name']=$temp;

Example :
$wp_session = WP_Session::get_instance();
$temp = current((array)$wp_session['session_name']);

/***

Work with the array

***/
unset ($wp_session['session_name']);
$wp_session['session_name']=$temp;
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