[wp-trac] [WordPress Trac] #25043: Add a pre_ hook to term_exists() to allow pre-query optimization

WordPress Trac noreply at wordpress.org
Tue Sep 29 18:52:17 UTC 2015


#25043: Add a pre_ hook to term_exists() to allow pre-query optimization
-------------------------+---------------------------
 Reporter:  dllh         |       Owner:  boonebgorges
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:
Component:  Taxonomy     |     Version:  3.6
 Severity:  normal       |  Resolution:  wontfix
 Keywords:  has-patch    |     Focuses:
-------------------------+---------------------------
Changes (by boonebgorges):

 * status:  assigned => closed
 * resolution:   => wontfix
 * milestone:  4.4 =>


Comment:

 `term_exists()` is a minefield that I think we ought to stay out of. Use
 `get_term_by()` to do precise lookups by name or slug, as necessary. (In
 the future, these calls will be cached. See #21760.) If you need to do a
 parent match, consider using `get_terms()`, which also caches its queries.

 Ideally, `term_exists()` would be phased out over time. Putting a hook in
 there marries us to the function.

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


More information about the wp-trac mailing list