title: $_SESSION not woking in wordpress
body: <p>Firstly I use below code for start session:</p>
  
  <pre><code>function sess_start() {
  if (!session_id())
      session_start();
  }
  add_action('init','sess_start');
  </code></pre>
  
  <p>I use <code>$_session</code> in wordpress in below method and this works correctly</p>
  
  <p>method 1:</p>
  
  <pre><code>$_SESSION['mycity']=4;
  </code></pre>
  
  <p>and in the other page I get <code>$_SESSION['mycity']</code> correctly=4.</p>
  
  <p>But when I use the below </p>
  
  <p>method 2:</p>
  
  <pre><code>$parent = get_the_category()[1]-&gt;cat_ID;     //get_the_category()[1]-&gt;cat_ID is = 4
  $_SESSION['mycity']=$parent;
  </code></pre>
  
  <p>I get <code>$_SESSION['mycity']=1</code> </p>
  
  <p>When I use second method in the footer I get <code>$_SESSION['mycity']=4</code> but in the another page I get <code>$_SESSION['mycity']=1</code></p>
  
  <p>now i found that when i use google chrom this problem solved, this problem when accor that i use firefox</p>