From 2daeac989d6f1e31be25a0d41bc3276a19cc46ae Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 26 Jun 2020 22:29:27 +0000 Subject: [PATCH] Taxonomy: Make sure `update_object_term_cache()` caches all terms that were not already cached. Due to an unintended `break` instruction from a previous iteration, the function cached only one term in each taxonomy. Follow-up to [48055]. Props Chouby. Fixes #50352. git-svn-id: https://develop.svn.wordpress.org/trunk@48187 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/taxonomy.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php index eaa380a1bd..9c4dc5f76d 100644 --- a/src/wp-includes/taxonomy.php +++ b/src/wp-includes/taxonomy.php @@ -3418,7 +3418,6 @@ function update_object_term_cache( $object_ids, $object_type ) { foreach ( $cache_values as $id => $value ) { if ( false === $value ) { $non_cached_ids[] = $id; - break; } } } @@ -3427,6 +3426,8 @@ function update_object_term_cache( $object_ids, $object_type ) { return false; } + $non_cached_ids = array_unique( $non_cached_ids ); + $terms = wp_get_object_terms( $non_cached_ids, $taxonomies,