[wp-trac] [WordPress Trac] #21760: get_term_by() calls are not cached

WordPress Trac noreply at wordpress.org
Sat Jan 16 20:59:07 UTC 2016


#21760: get_term_by() calls are not cached
-------------------------------------+-----------------------------
 Reporter:  wonderboymusic           |       Owner:  wonderboymusic
     Type:  enhancement              |      Status:  reopened
 Priority:  normal                   |   Milestone:  Future Release
Component:  Taxonomy                 |     Version:  2.3
 Severity:  normal                   |  Resolution:
 Keywords:  needs-patch 2nd-opinion  |     Focuses:
-------------------------------------+-----------------------------

Comment (by boonebgorges):

 Brainstorm: Why not make `get_term_by()` a wrapper for `get_terms()`? The
 latter function has 'name' and 'slug' params, and 'term_id' and
 'term_taxonomy_id' would be trivial to add. More importantly,
 `get_terms()` queries are already fairly heavily cached.

 The biggest concern would be performance. `get_terms()` adds lots of CPU
 cycles, its cache strategy is perhaps less efficient (parameter hashes as
 keys), and its SQL queries may not be as optimized. That being said, it
 may be worth a small performance hit on uncached queries in exchange for
 cache coverage of `get_term_by()`, as well as the increase in DRYness.

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


More information about the wp-trac mailing list