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

WordPress Trac noreply at wordpress.org
Fri Feb 18 15:07:08 UTC 2022


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

Comment (by flixos90):

 @spacedmonkey As far as I understand @boonebgorges's concerns, it's not
 only about cache invalidation but also about the expectation that the
 `term_exists()` function has always been using uncached and unfiltered SQL
 queries, which is now being changed with this patch, so there is certainly
 risk of breakage. At the same time, it's IMO an obscure expectation that a
 certain query should be cached - in a way, that would mean we could never
 add caching to something after introducing an uncached query. Again, a
 safer approach would be to phase out `term_exists()` usage, and maybe even
 deprecate it. Related question: What does that mean for
 [https://developer.wordpress.org/reference/functions/post_exists/
 `post_exists()`]? Maybe we should align on one approach for both of these
 functions before actually committing something.

 I agree that writing a dev note with examples will be important if you
 commit this change.

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


More information about the wp-trac mailing list