[wp-trac] [WordPress Trac] #37038: WP_Tax_Query needs caching

WordPress Trac noreply at wordpress.org
Sat Jun 11 04:01:55 UTC 2016


#37038: WP_Tax_Query needs caching
------------------------------------------+-----------------------------
 Reporter:  spacedmonkey                  |       Owner:
     Type:  enhancement                   |      Status:  new
 Priority:  normal                        |   Milestone:  Future Release
Component:  Query                         |     Version:  3.1
 Severity:  normal                        |  Resolution:
 Keywords:  needs-unit-tests needs-patch  |     Focuses:  performance
------------------------------------------+-----------------------------
Changes (by boonebgorges):

 * keywords:  has-patch needs-unit-tests => needs-unit-tests needs-patch
 * milestone:  Awaiting Review => Future Release


Comment:

 I added `term_taxonomy_id` support to `WP_Term_Query` in [37683]. See
 #37074.

 I opted *not* to include `fields` support for `term_taxonomy_id`. I'm
 generally against fine-grained `SELECT x` parameters in our query classes,
 because (appropriately for this ticket) they mess with our caching
 strategy. In the case of term queries, it doesn't currently matter because
 we (wastefully) keep separate caches for each value of `fields`. But when
 we move to caching only term IDs and pulling additional data from the
 cache, the presence of 'fields' is going to mess things up. See #34239.
 For the purposes of this ticket, this means fetching the entire term
 objects and plucking out the values that are needed.

 Implementation question: Why the `sanitize_term_field()` juggling for
 `name`? This kind of sanitization is already handled in `WP_Term_Query`,
 isn't it?

 Worth noting that this ticket is a duplicate of a number of others. A
 quick search brings up #16621 and #14983, though there are probably
 others. The strategy in the current ticket seems like the right one to me,
 but I want to be sure we go through and reference relevant tickets as
 necessary.

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


More information about the wp-trac mailing list