Make WordPress Core


Ignore:
Timestamp:
05/16/2023 12:29:34 PM (19 months ago)
Author:
spacedmonkey
Message:

Taxonomy: Do not prime term meta in wp_get_object_terms.

Passing update_term_meta_cache argument value false by default resulting in get_terms to not prime the term meta cache in wp_get_object_terms. Priming of term meta is not needed in this context.

Props spacedmonkey, rutviksavsani.
Fixes #57701.

File:
1 edited

Legend:

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

    r55703 r55759  
    21932193 *              'all_with_object_id', an array of `WP_Term` objects will be returned.
    21942194 * @since 4.7.0 Refactored to use WP_Term_Query, and to support any WP_Term_Query arguments.
     2195 * @since 6.3.0 Passing `update_term_meta_cache` argument value false by default resulting in get_terms() to not
     2196 *              prime the term meta cache.
    21952197 *
    21962198 * @param int|int[]       $object_ids The ID(s) of the object(s) to retrieve.
     
    22212223    $object_ids = array_map( 'intval', $object_ids );
    22222224
    2223     $args = wp_parse_args( $args );
     2225    $defaults = array(
     2226        'update_term_meta_cache' => false,
     2227    );
     2228
     2229    $args = wp_parse_args( $args, $defaults );
    22242230
    22252231    /**
Note: See TracChangeset for help on using the changeset viewer.