Changeset 12116
- Timestamp:
- 10/27/2009 03:51:58 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/comment.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/comment.php
r12042 r12116 767 767 return $count; 768 768 769 $where = 'WHERE '; 770 if( $post_id > 0 ) 771 $where .= $wpdb->prepare( "c.comment_post_ID = %d AND ", $post_id ); 772 $where .= "p.post_status <> 'trash'"; 773 774 $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} c LEFT JOIN {$wpdb->posts} p ON c.comment_post_ID = p.ID {$where} GROUP BY comment_approved", ARRAY_A ); 769 $where = ''; 770 if ( $post_id > 0 ) 771 $where = $wpdb->prepare( "comment_post_ID = %d AND ", $post_id ); 772 773 $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A ); 775 774 776 775 $total = 0;
Note: See TracChangeset
for help on using the changeset viewer.