From 267cc99293e3e47c8bc93159743a7eafaf8715e1 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Wed, 25 May 2016 18:44:29 +0000 Subject: [PATCH] Fix termmeta pre-fetching in `wp_get_object_terms()`. [34529] introduced logic intended to prime the termmeta cache for certain values of the `fields` parameter. There were a few bugs: * The `all_with_object_id` param was misspelled. * `term_id` was used instead of `ids`. * The values being passed to `update_termmeta_cache()` in the case where `fields=ids` was not correct. All of these would result in a failure to pre-fetch termmeta in some cases. Props dlh. Fixes #36932. Built from https://develop.svn.wordpress.org/trunk@37567 git-svn-id: http://core.svn.wordpress.org/trunk@37535 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 6 +++--- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index a60052c2da..ad3fba6714 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -2628,9 +2628,9 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) { } // Update termmeta cache, if necessary. - if ( $args['update_term_meta_cache'] && ( 'all' === $fields || 'all_with_object_ids' === $fields || 'term_id' === $fields ) ) { - if ( 'term_id' === $fields ) { - $term_ids = $fields; + if ( $args['update_term_meta_cache'] && ( 'all' === $fields || 'all_with_object_id' === $fields || 'ids' === $fields ) ) { + if ( 'ids' === $fields ) { + $term_ids = $terms; } else { $term_ids = wp_list_pluck( $terms, 'term_id' ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 631aa84043..9506c8a9f1 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-alpha-37566'; +$wp_version = '4.6-alpha-37567'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.