Make WordPress Core

Opened 9 months ago

Last modified 9 months ago

#42104 new defect (bug)

Tax query transformations unintentionally filtered by 'terms_clauses'

Reported by: Chouby Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9
Component: Taxonomy Keywords: has-patch
Focuses: Cc:


Since [40918] tax queries are transformed using WP_Term_Query. That's nice because the previously uncached query is now cached.

This however raises a backward compatibility issue as all existing filters applied to a term query are now unintentionnally applied to the tax query transformation.

The same kind of issue was raised by [38667], when the usage of WP_Term_Query was introduced in wp_get_object_terms(). However in this latest case, the unique presence of $args['object_ids'] in the arguments, not interpreted by WP_Term_Query, allows to differentiate term queries fired wp_get_object_terms(). There is no such unique argument which could serve the same purpose for the tax_query transformation.

I suggest to add a dummy parameter to the arguments of the query which would not be interpreted by the core and would only be useful to plugins to distinguish this query from others.

Attachments (1)

42104.patch (295 bytes) - added by Chouby 9 months ago.

Download all attachments as: .zip

Change History (2)

9 months ago

#1 @Chouby
9 months ago

  • Keywords has-patch added
Note: See TracTickets for help on using tickets.