Don't use term IDs for array indexes when caching object terms.

Uncached results pulled from `wp_get_object_terms()` are zero-indexed (ie 0,
1, 2...). As a result, `get_the_terms()` was returning a strictly different
array when pulling from the cache and when the cache was empty.

Props joshlevinson.
Fixes #31086.

git-svn-id: https://develop.svn.wordpress.org/trunk@31287 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-01-28 20:42:25 +00:00
parent a57a612c95
commit 2e848072eb
2 changed files with 30 additions and 1 deletions

View File

@@ -3783,7 +3783,7 @@ function update_object_term_cache($object_ids, $object_type) {
$object_terms = array();
foreach ( (array) $terms as $term )
$object_terms[$term->object_id][$term->taxonomy][$term->term_id] = $term;
$object_terms[$term->object_id][$term->taxonomy][] = $term;
foreach ( $ids as $id ) {
foreach ( $taxonomies as $taxonomy ) {