title: Wordpress wp_reset_query() does not go back to last query?
body: <p>This is what I have:</p>
  
  <p>Im editing a custom taxonomy page. On landing on the page the page query is automatically set to return a list of posts under the custom taxonomy I'm on. In that page template I run this query posts:</p>
  
  <pre><code>        query_posts(
              array_merge(
                  array( 'post__in' =&gt; $_SESSION['lpoc_search_data'], 'orderby' =&gt; 'post__in' ),
                  $wp_query-&gt;query
              )
          );
  </code></pre>
  
  <p>I run my loop and the query Ive done above works all well.</p>
  
  <pre><code>&lt;?php while (have_posts()) : the_post(); ?&gt;
    My Loop
  &lt;?php endwhile; ?&gt;
  </code></pre>
  
  <p>But inside the above loop I do another query:</p>
  
  <pre><code>      &lt;?php $args = array('p' =&gt; $officeID, 'post_type' =&gt; "offices"); query_posts($args); ?&gt;
        &lt;?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?&gt;
           //Inside secondary loop
        &lt;?php endwhile; ?&gt;
        &lt;?php wp_reset_query(); ?&gt;
  </code></pre>
  
  <p>As you can see I use wp_reset_query(); so that the loop above is returned to its original state. Or so you would think. But what is happening is that wp_reset_query() is resetting the query to the page query and not the query I did in the first code block. Why is this happening and how can I prevent this from happening?</p>
  
  <p>Kind Regards</p>
  
  <p>Scott</p>