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

WordPress Trac noreply at wordpress.org
Tue Feb 22 11:01:30 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):

 No @peterwilsoncc that is a good question.

 It would simple to change the current workaround for bypassing caches,
 from this.

 {{{#!php
   if ( defined( 'WP_IMPORTING' ) && WP_IMPORTING ) {
      $defaults['cache_domain'] = microtime();
   }

 }}}

 To

 {{{#!php
    function term_exists( $term, $taxonomy = '', $parent = null ) {
     global $_wp_suspend_cache_invalidation;
     ...
     if ( !empty( $_wp_suspend_cache_invalidation ) ) {
        $defaults['cache_domain'] = microtime();
     }
 }}}

 This logic is a little cleaner and might catch more of the edge cases we
 are worried about. I once called `wp_suspend_cache_invalidation` in a
 custom migration tool I wrote...

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


More information about the wp-trac mailing list