From b49912434d5d7cbe85c601d265e64cbe1d5e61c0 Mon Sep 17 00:00:00 2001 From: spacedmonkey Date: Tue, 16 May 2023 12:31:21 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@55759 git-svn-id: http://core.svn.wordpress.org/trunk@55271 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 8 +++++++- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 178aa08f7b..71280f0437 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -2192,6 +2192,8 @@ function wp_delete_category( $cat_id ) { * @since 4.4.0 Introduced `$meta_query` and `$update_term_meta_cache` arguments. When `$fields` is 'all' or * 'all_with_object_id', an array of `WP_Term` objects will be returned. * @since 4.7.0 Refactored to use WP_Term_Query, and to support any WP_Term_Query arguments. + * @since 6.3.0 Passing `update_term_meta_cache` argument value false by default resulting in get_terms() to not + * prime the term meta cache. * * @param int|int[] $object_ids The ID(s) of the object(s) to retrieve. * @param string|string[] $taxonomies The taxonomy names to retrieve terms from. @@ -2220,7 +2222,11 @@ function wp_get_object_terms( $object_ids, $taxonomies, $args = array() ) { } $object_ids = array_map( 'intval', $object_ids ); - $args = wp_parse_args( $args ); + $defaults = array( + 'update_term_meta_cache' => false, + ); + + $args = wp_parse_args( $args, $defaults ); /** * Filters arguments for retrieving object terms. diff --git a/wp-includes/version.php b/wp-includes/version.php index b2afee4f19..e9b7b9bcee 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-alpha-55758'; +$wp_version = '6.3-alpha-55759'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.