Make WordPress Core


Ignore:
Timestamp:
11/22/2005 03:40:32 AM (19 years ago)
Author:
ryan
Message:

Count only approved comments. Props Mark JAquith. fixes #1930

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/upgrade-functions.php

    r3183 r3192  
    303303
    304304    // populate comment_count field of posts table
    305     $comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments GROUP BY comment_post_ID" );
     305    $comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" );
    306306    if( is_array( $comments ) ) {
    307307        foreach ($comments as $comment) {
Note: See TracChangeset for help on using the changeset viewer.