WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm truly stumped here. I have a specific taxonomy for sorting posts into different types of "featured" posts on a news site. Here's the problem: When querying by them the results aren't what they should be. Here's what I have:

$featured_loop = new WP_Query( array( 'featured' => 'home-featured', 'posts_per_page' => '1') );
if ( have_posts() ):
        while ( $featured_loop->have_posts() ) : $featured_loop->the_post();

There is then another underneath, with different formatting:

$featured_loop_2 = new WP_Query( array( 'featured' => 'home-featured', 'posts_per_page' => '3', 'offset' => '1') );
if ( have_posts() ):
        while ( $featured_loop->have_posts() ) : $featured_loop->the_post();

The problem is, it is outputting posts that aren't in the taxonomy... although which ones it outputs changes as I tweak it, which I find even more strange. I tried a tax_query, and that didn't seem to solve it either. Any ideas?

I used "Ultimate Taxonomy Manager" to create the taxonomy.

share|improve this question
Do you use those queries on same page? or is there any other queries like WordPress's default loop? – Mamaduka Mar 22 '12 at 7:45
They're both on the same page, yessir. The loop isn't in there, yet. Each is showing 1 post (the second should show 3) and they're just the two latest, not from the 'featured' taxonomy. – Tim Mar 22 '12 at 14:16

If you're using multiple queries on same page, you should always use wp_reset_query, place it after loops.

share|improve this answer
up vote 0 down vote accepted

Turned out to be a silly mistake, of course. If you look closely you see $featured_loop->the_post(); the_post(); . Which means that the_post(); was repeated, accidentally. Glad that's fixed!

share|improve this answer
Did this resolve your issue though? You don't seem to be querying for any taxonomies? – mrwweb May 1 '12 at 1:10
I believe it did. I was querying for the posts in home-featured term of the featured taxonomy. There were other mistakes that I uncovered as I went along, although I don't think that there were any related to the featured-stories functionality. – Tim May 2 '12 at 18:57
Great. I'm surprised that's working without a tax_query, but I guess if it works it works. Please accept your own answer (the green check mark) to indicate that you found a solution. – mrwweb May 2 '12 at 19:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.