[wp-trac] [WordPress Trac] #42104: Tax query transformations unintentionally filtered by 'terms_clauses'

WordPress Trac noreply at wordpress.org
Thu Oct 5 09:32:40 UTC 2017


#42104: Tax query transformations unintentionally filtered by 'terms_clauses'
--------------------------+-----------------------------
 Reporter:  Chouby        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Taxonomy      |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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.

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


More information about the wp-trac mailing list