Make WordPress Core


Ignore:
Timestamp:
11/28/2005 09:37:17 AM (21 years ago)
Author:
matt
Message:

Another query bites the dust!

File:
1 edited

Legend:

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

    r3218 r3219  
    13011301                $post_id_array[] = $posts[$i]->ID;
    13021302                $post_cache[$posts[$i]->ID] = &$posts[$i];
     1303                $comment_count_cache[$posts[$i]->ID] = $posts[$i]->comment_count;
    13031304        }
    13041305
     
    13061307
    13071308        update_post_category_cache($post_id_list);
    1308 
    1309         // Do the same for comment numbers
    1310         $comment_counts = $wpdb->get_results( "SELECT ID as comment_post_ID, comment_count as ccount FROM $wpdb->posts WHERE ID in ($post_id_list)" );
    1311 
    1312         if ( $comment_counts ) {
    1313                 foreach ($comment_counts as $comment_count) {
    1314                         $comment_count_cache["$comment_count->comment_post_ID"] = $comment_count->ccount;
    1315                         $has_comments[] = $comment_count->comment_post_ID;
    1316                 }
    1317                 $no_comments = array_diff( $post_id_array, $has_comments );
    1318                 foreach ( $no_comments as $id )
    1319                         $comment_count_cache["$id"] = 0;
    1320         }
    13211309
    13221310        // Get post-meta info
Note: See TracChangeset for help on using the changeset viewer.