Changeset 6286
- Timestamp:
- 10/23/07 20:33:50 (1 year ago)
- Files:
-
- trunk/wp-includes/taxonomy.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-includes/taxonomy.php
r6285 r6286 1430 1430 */ 1431 1431 function &get_object_term_cache($id, $taxonomy) { 1432 $terms = wp_cache_get($id, 'object_terms'); 1433 if ( false !== $terms ) { 1434 if ( isset($terms[$taxonomy]) ) 1435 return $terms[$taxonomy]; 1436 else 1437 return array(); 1438 } 1439 1440 return false; 1432 return wp_cache_get($id, "{$taxonomy}_relationships"); 1441 1433 } 1442 1434 … … 1466 1458 $object_ids = array_map('intval', $object_ids); 1467 1459 1460 $taxonomies = get_object_taxonomies($object_type); 1461 1468 1462 $ids = array(); 1469 1463 foreach ( (array) $object_ids as $id ) { 1470 if ( false === wp_cache_get($id, 'object_terms') ) 1471 $ids[] = $id; 1464 foreach ( $taxonomies as $taxonomy ) { 1465 if ( false === wp_cache_get($id, "{$taxonomy}_relationships") ) { 1466 $ids[] = $id; 1467 break; 1468 } 1469 } 1472 1470 } 1473 1471 … … 1475 1473 return false; 1476 1474 1477 $terms = wp_get_object_terms($ids, get_object_taxonomies($object_type), 'fields=all_with_object_id');1475 $terms = wp_get_object_terms($ids, $taxonomies, 'fields=all_with_object_id'); 1478 1476 1479 1477 $object_terms = array(); … … 1482 1480 1483 1481 foreach ( $ids as $id ) { 1484 if ( ! isset($object_terms[$id]) ) 1485 $object_terms[$id] = array(); 1486 } 1487 1488 foreach ( $object_terms as $id => $value ) 1489 wp_cache_set($id, $value, 'object_terms'); 1482 foreach ( $taxonomies as $taxonomy ) { 1483 if ( ! isset($object_terms[$id][$taxonomy]) ) { 1484 if ( !isset($object_terms[$id]) ) 1485 $object_terms[$id] = array(); 1486 $object_terms[$id][$taxonomy] = array(); 1487 } 1488 } 1489 } 1490 1491 foreach ( $object_terms as $id => $value ) { 1492 foreach ( $value as $taxonomy => $terms ) { 1493 wp_cache_set($id, $terms, "{$taxonomy}_relationships"); 1494 } 1495 } 1490 1496 } 1491 1497
