[wp-trac] [WordPress Trac] #29416: WP_Query tax_query :: terms array with one item doesn't query properly

WordPress Trac noreply at wordpress.org
Thu Aug 28 21:49:53 UTC 2014


#29416: WP_Query tax_query :: terms array with one item doesn't query properly
-------------------------------+------------------------------
 Reporter:  robertark          |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Query              |     Version:  3.9.2
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------
Changes (by johnbillion):

 * keywords:   => reporter-feedback


Comment:

 Thanks for the report Rob.

 I'm unable to reproduce the problem. This is the SQL generated (excluding
 the meta query for brevity):

 {{{
 SELECT wp_posts.*
 FROM wp_posts
 WHERE 1=1
 AND (
         wp_posts.ID NOT IN (
                 SELECT object_id
                 FROM wp_term_relationships
                 WHERE term_taxonomy_id IN (3)
         )
 )
 AND wp_posts.post_type = 'product'
 AND (
         wp_posts.post_status = 'publish'
         OR wp_posts.post_status = 'future'
         OR wp_posts.post_status = 'draft'
         OR wp_posts.post_status = 'pending'
         OR wp_posts.post_status = 'private'
 )
 GROUP BY wp_posts.ID
 ORDER BY wp_posts.post_date DESC
 }}}

 Some things to check:

  * Does the `accessories` term actually exist in the `product_type`
 taxonomy on your site?
  * Do you have any plugins active on your site which might be filtering
 the query arguments or the query SQL? You can dump the value of
 `$products->request` to see what the SQL looks like.
  * Does the behaviour change if you add more elements to the `terms`
 array?

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


More information about the wp-trac mailing list