Ticket #12989: 12989.2.diff
File 12989.2.diff, 1.7 KB (added by , 15 years ago) |
---|
-
wp-includes/post.php
3990 3990 * @uses update_postmeta_cache() 3991 3991 * 3992 3992 * @param array $posts Array of Post objects 3993 * @param string $post_type The post type of the posts in $posts 3993 3994 */ 3994 function update_post_caches(&$posts ) {3995 function update_post_caches(&$posts, $post_type = 'post') { 3995 3996 // No point in doing all this work if we didn't match any posts. 3996 3997 if ( !$posts ) 3997 3998 return; … … 3999 4000 update_post_cache($posts); 4000 4001 4001 4002 $post_ids = array(); 4003 foreach ( $posts as $post ) 4004 $post_ids[] = $post->ID; 4002 4005 4003 for ($i = 0; $i < count($posts); $i++)4004 $post_ ids[] = $posts[$i]->ID;4006 if ( empty($post_type) ) 4007 $post_type = 'post'; 4005 4008 4006 update_object_term_cache($post_ids, 'post'); 4009 if ( !is_array($post_type) && 'any' != $post_type ) 4010 update_object_term_cache($post_ids, $post_type); 4007 4011 4008 4012 update_postmeta_cache($post_ids); 4009 4013 } -
wp-includes/query.php
1626 1626 if ( !isset($q['suppress_filters']) ) 1627 1627 $q['suppress_filters'] = false; 1628 1628 1629 if ( !isset($q['cache_results']) ) 1630 $q['cache_results'] = true; 1631 1629 1632 if ( !isset($q['post_type']) ) { 1630 1633 if ( $this->is_search ) 1631 1634 $q['post_type'] = 'any'; … … 2504 2507 $this->posts[$i] = sanitize_post($this->posts[$i], 'raw'); 2505 2508 } 2506 2509 2507 update_post_caches($this->posts); 2510 if ( $q['cache_results'] ) 2511 update_post_caches($this->posts, $post_type); 2508 2512 2509 2513 if ($this->post_count > 0) { 2510 2514 $this->post = $this->posts[0];