Cache terms under more scenario's in update_post_caches(). Fixes #15026

git-svn-id: https://develop.svn.wordpress.org/trunk@15700 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse 2010-10-04 08:56:04 +00:00
parent 8e067e926c
commit d837eb9f8f
1 changed files with 15 additions and 2 deletions

View File

@ -4096,8 +4096,21 @@ function update_post_caches(&$posts, $post_type = 'post', $update_term_cache = t
if ( empty($post_type) )
$post_type = 'post';
if ( !is_array($post_type) && 'any' != $post_type && $update_term_cache )
update_object_term_cache($post_ids, $post_type);
if ( $update_term_cache ) {
if ( is_array($post_type) ) {
$ptypes = $post_type;
} elseif ( 'any' == $post_type ) {
// Just use the post_types in the supplied posts.
foreach ( $posts as $post )
$ptypes[] = $post->post_type;
$ptypes = array_unique($ptypes);
} else {
$ptypes = array($post_type);
}
if ( ! empty($ptypes) )
update_object_term_cache($post_ids, $ptypes);
}
if ( $update_meta_cache )
update_postmeta_cache($post_ids);