[wp-trac] [WordPress Trac] #33318: tax_query breaks certain other wp_query args

WordPress Trac noreply at wordpress.org
Sun Aug 9 19:39:51 UTC 2015


#33318: tax_query breaks certain other wp_query args
--------------------------+-----------------------------
 Reporter:  djripraw      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  4.2.4
 Severity:  normal        |   Keywords:
  Focuses:  template      |
--------------------------+-----------------------------
 I'm finding on a single post page that creating a wp_query with tax_query
 included in the args breaks certain other query arguments. Namely the
 posts_per_page argument isn't working. If i remove the tax_query,
 posts_per_page works.


 {{{
 <?php
 $args_new = array(
         'post_type' => 'store',
         'posts_per_page' => 2,
         'orderby' => 'date',
         'order' => 'DESC',
         'tax_query' => array(
                 array(
                         'taxonomy' => 'store_artist',
                         'field'    => 'term_id',
                         'terms'    => array( $artist_store_link ),
                 ),
         ),
 );
 $query2 = new WP_Query( $args_new );
 ?>

 <?php if ( $query2->have_posts() ) : ?>

 <div class="cell-12 cell-lg-12">

         <h2 class="headline-2">Tracks by <?php echo get_the_title();
 ?></h2>
         <div class="group">

         <?php while ( $query2->have_posts() ) : $query2->the_post(); ?>

                 <?php get_template_part('partials/store-archive'); ?>

         <?php endwhile; ?>

         <?php wp_reset_postdata(); ?>

         </div>
 </div>

 <?php endif; ?>

 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33318>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list