title: How context works inside php foreach?
body: <p>I'm writing a simple tab navigation and I'm facing this issue:</p>
  
  <p>The function <code>print_office</code> works only when I'm inside a foreach.</p>
  
  <pre><code>//Doesn't work
  print_office($loop-&gt;posts[0], true);
  
  //Works
  foreach ($loop-&gt;posts as $index =&gt; $post) {
      print_office($post, true);
  }
  </code></pre>
  
  <p>The <code>print_office</code> function makes use of Advanced Custom Fields' <code>get_field('field_name')</code>.</p>
  
  <p>EDIT:</p>
  
  <p>I've put a <code>var_dump($office)</code> inside <code>print_office</code>.</p>
  
  <p>When called <strong>outside</strong> the <code>foreach</code> I get:</p>
  
  <pre><code>object(WP_Post)#317 (24) {
    ["ID"]=&gt; int(7)
    ["post_author"]=&gt; string(1) "1"
  
    [.....] //More fields;
  }
  </code></pre>
  
  <p>When called <strong>inside</strong> the <code>foreach</code>I get:</p>
  
  <pre><code>FOREACH:object(WP_Post)#317 (24) {
    ["ID"]=&gt; int(7)
    ["post_author"]=&gt; string(1) "1"
  
    [.....] //More fields;
  }
  </code></pre>
  
  <p>So the only difference is that: <code>FOREACH:object</code> instead of just <code>object</code>.</p>