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
This commit is contained in:
Boone Gorges 2016-05-25 18:44:29 +00:00
parent a74fae7bd6
commit 267cc99293
2 changed files with 4 additions and 4 deletions

View File

@ -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' );
}

View File

@ -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.