Make WordPress Core


Ignore:
Timestamp:
02/05/2018 04:09:27 AM (9 years ago)
Author:
peterwilsoncc
Message:

Taxonomy: Stop warming term meta cache unnecessarily.

Prevent several core function calls to get_terms() from warming the term meta cache.

Props peterwilsoncc, boonebgorges, jrf.
Fixes #43142.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r42343 r42649  
    21482148        $name_matches = get_terms(
    21492149                $taxonomy, array(
    2150                         'name'       => $name,
    2151                         'hide_empty' => false,
    2152                         'parent'     => $args['parent'],
     2150                        'name'                   => $name,
     2151                        'hide_empty'             => false,
     2152                        'parent'                 => $args['parent'],
     2153                        'update_term_meta_cache' => false,
    21532154                )
    21542155        );
    … …  
    21742175                                $siblings = get_terms(
    21752176                                        $taxonomy, array(
    2176                                                 'get'    => 'all',
    2177                                                 'parent' => $parent,
     2177                                                'get'                    => 'all',
     2178                                                'parent'                 => $parent,
     2179                                                'update_term_meta_cache' => false,
    21782180                                        )
    21792181                                );
    … …  
    23652367                $old_tt_ids = wp_get_object_terms(
    23662368                        $object_id, $taxonomy, array(
    2367                                 'fields'  => 'tt_ids',
    2368                                 'orderby' => 'none',
     2369                                'fields'                 => 'tt_ids',
     2370                                'orderby'                => 'none',
     2371                                'update_term_meta_cache' => false,
    23692372                        )
    23702373                );
    … …  
    24552458                $values       = array();
    24562459                $term_order   = 0;
    2457                 $final_tt_ids = wp_get_object_terms( $object_id, $taxonomy, array( 'fields' => 'tt_ids' ) );
     2460                $final_tt_ids = wp_get_object_terms(
     2461                        $object_id,
     2462                        $taxonomy,
     2463                        array(
     2464                                'fields'                 => 'tt_ids',
     2465                                'update_term_meta_cache' => false,
     2466                        )
     2467                );
    24582468                foreach ( $tt_ids as $tt_id ) {
    24592469                        if ( in_array( $tt_id, $final_tt_ids ) ) {
    … …  
    33833393        $terms    = get_terms(
    33843394                $taxonomy, array(
    3385                         'get'     => 'all',
    3386                         'orderby' => 'id',
    3387                         'fields'  => 'id=>parent',
     3395                        'get'                    => 'all',
     3396                        'orderby'                => 'id',
     3397                        'fields'                 => 'id=>parent',
     3398                        'update_term_meta_cache' => false,
    33883399                )
    33893400        );
Note: See TracChangeset for help on using the changeset viewer.