[wp-trac] [WordPress Trac] #36949: Term exists should use get_terms internally

WordPress Trac noreply at wordpress.org
Fri Mar 11 11:05:17 UTC 2022

#36949: Term exists should use get_terms internally
 Reporter:  spacedmonkey                         |       Owner:
                                                 |  spacedmonkey
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  6.0
Component:  Taxonomy                             |     Version:  2.3
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests needs-dev-  |     Focuses:
  note needs-testing commit                      |  performance
Changes (by spacedmonkey):

 * status:  assigned => closed
 * resolution:   => fixed


 In [changeset:"52921" 52921]:
 #!CommitTicketReference repository="" revision="52921"
 Taxonomy: Use `get_terms` instead of a database lookup in `term_exists()`.

 Replace raw SQL queries to the terms table, with a call to the `get_terms`
 function. Using `get_terms` means that `term_exists` is now cached. For
 developers using `term_exists` where cache invalidation is disabled, such
 as importing, a workaround was added to ensure that queries are uncached.

 Props Spacedmonkey, boonebgorges, flixos90, peterwilsoncc.
 Fixes #36949.

Ticket URL: <https://core.trac.wordpress.org/ticket/36949#comment:33>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list