Make WordPress Core


Ignore:
Timestamp:
05/10/2010 12:58:39 AM (14 years ago)
Author:
ryan
Message:

Allow turning off object_term and postmeta cache updates. Turn off object_term updates in the wp_get_nav_menu_items() get_posts() query to avoid useless taxonomy query.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r14521 r14528  
    40044004 *
    40054005 * @param array $posts Array of Post objects
    4006  * @param string $post_type The post type of the posts in $posts
    4007  */
    4008 function update_post_caches(&$posts, $post_type = 'post') {
     4006 * @param string $post_type The post type of the posts in $posts. Default is 'post'.
     4007 * @param bool $update_term_cache Whether to update the term cache. Default is true.
     4008 * @param bool $update_meta_cache Whether to update the meta cache. Default is true.
     4009 */
     4010function update_post_caches(&$posts, $post_type = 'post', $update_term_cache = true, $update_meta_cache = true) {
    40094011    // No point in doing all this work if we didn't match any posts.
    40104012    if ( !$posts )
     
    40204022        $post_type = 'post';
    40214023
    4022     if ( !is_array($post_type) && 'any' != $post_type )
     4024    if ( !is_array($post_type) && 'any' != $post_type && $update_term_cache )
    40234025        update_object_term_cache($post_ids, $post_type);
    40244026
    4025     update_postmeta_cache($post_ids);
     4027    if ( $update_meta_cache )
     4028        update_postmeta_cache($post_ids);
    40264029}
    40274030
Note: See TracChangeset for help on using the changeset viewer.