[wp-trac] [WordPress Trac] #41246: Filter to short circuit term query 'terms_pre_query'

WordPress Trac noreply at wordpress.org
Tue Jan 8 02:51:17 UTC 2019


#41246: Filter to short circuit term query 'terms_pre_query'
-------------------------+-----------------------------
 Reporter:  jarocks      |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  Taxonomy     |     Version:  4.6
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+-----------------------------

Comment (by boonebgorges):

 Thanks for the ping, @adamsilverstein . [attachment:"41246.2.diff"] seems
 OK to me. Regarding caching, I'd say that core should definitely not be
 caching the results of short-circuited queries - this kind of "pre" filter
 hands over all such responsibilities to the plugin.

 I'm not sure what you mean by "updating term counts". Do you mean
 `_update_post_term_count()` etc? These are not term counts but *object-in-
 term* counts, and they don't touch the `WP_Term_Query` results. (They do
 depend on the `term_taxonomy_id` from WP's database tables, but again, any
 plugin using this filter is going to have to figure out how to reconcile
 this information on its own.) Or by "term counts" do you mean `get_terms(
 fields=count )`? In this case too, I'd say that the terms_pre_query
 callback will just have to be smart enough to detect 'count' queries and
 return the right results - not much that we can do in core.

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


More information about the wp-trac mailing list