WordPress.org

Ready to get started?Download WordPress

Forums

WP Session Manager
array storing (1 post)

  1. sarankumar
    Member
    Posted 2 months ago #

    iam tring to store an array using wp-sessions.my code shown below.

    if(isset($_POST['id']))
    		{
    		$wp_session = WP_Session::get_instance();
    		if(isset($wp_session['ym_cart']))
    		  {
    		$wp_session['ym_cart'][]=$_POST['id'];
    		 }
                      else
    		{
    		$wp_session['ym_cart']= array();
    		$wp_session['ym_cart'][]=$_POST['id'];
    		}
    
    		print_r($wp_session['ym_cart']);
    
    	    }

    'ID' is coming from an ajax form submission.Error is array storing only one value.How can i push values to these array ?

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

Reply

You must log in to post.

About this Plugin

About this Topic