[wp-trac] [WordPress Trac] #36343: Taxonomy query matching specified term or NOT EXISTS does not return expected result

WordPress Trac noreply at wordpress.org
Mon Mar 28 10:33:48 UTC 2016


#36343: Taxonomy query matching specified term or NOT EXISTS does not return
expected result
--------------------------------------+-----------------------------
 Reporter:  crstauf                   |       Owner:
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Future Release
Component:  Query                     |     Version:  4.1
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-----------------------------
Changes (by swissspidy):

 * keywords:  reporter-feedback => has-patch has-unit-tests
 * version:  4.4.2 => 4.1
 * milestone:  Awaiting Review => Future Release


Comment:

 Regular posts have at least 1 assigned term on creation (the default
 category). Custom post types don't.

 And since tax queries perform an `INNER JOIN` on the
 `wptests_term_relationships` table, posts without any assigned terms are
 not included in the result set.

 Changing the tax query to use a `LEFT JOIN` fixes this problem without
 causing any of the other tests to fail. [attachment:36343.2.diff]
 demonstrates this.

 @boonebgorges Since you're the taxonomy wizard, what's your opinion on the
 patch?

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


More information about the wp-trac mailing list