WordPress.org

Make WordPress Core

Ticket #4529: 4529.001.diff

File 4529.001.diff, 514 bytes (added by aaroncampbell, 4 years ago)

Fix possible bad query introduced in r12116

  • comment.php

     
    768768 
    769769        $where = ''; 
    770770        if ( $post_id > 0 ) 
    771                 $where = $wpdb->prepare( "comment_post_ID = %d AND ", $post_id ); 
     771                $where = $wpdb->prepare( "WHERE comment_post_ID = %d ", $post_id ); 
    772772 
    773773        $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A ); 
    774774