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

WordPress Trac noreply at wordpress.org
Wed May 25 07:08:25 UTC 2016


#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             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:  template
-------------------------------+------------------------------

Comment (by m_i_n):

 I've made some tests and I can see it matters if it's a custom post type,
 not regular post.

 This query gives 2 results...

 {{{
 <?php
 $args = array(
         'post_type'      => 'books',
         'posts_per_page' => 2
 );
 $query = new WP_Query($args);
 }}}

 but...

 {{{
 <?php
 $args = array(
         'post_type'      => 'books',
         'posts_per_page' => 2,
         'tax_query'      => array(
                 array(
                         'taxonomy' => 'book-category',
                         'field'    => 'term_id',
                         'terms'    => array(16),
                 )
         )
 );
 $query = new WP_Query($args);
 }}}

 gives all `book-category=16` results like the `posts_per_page` parameter
 would not exist.

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


More information about the wp-trac mailing list