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

WordPress Trac noreply at wordpress.org
Tue Mar 1 16:56:22 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 spacedmonkey):

 I have actioned feedback from @peterwilsoncc. If now uses
 `$_wp_suspend_cache_invalidation` global. This makes the code a lot
 cleaner and means I could add a unit test.

 If now means if you want an uncached term_exists call you can do this.

 {{{#!php
    wp_suspend_cache_invalidation( true );
    $term = term_exists( 'thing' );
    wp_suspend_cache_invalidation( false );
 }}}

 Which might be useful for devs.

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


More information about the wp-trac mailing list