diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index 80dfc5457e..716b38a8a2 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -396,17 +396,25 @@ function wp_dashboard_recent_drafts( $drafts = false ) { * @since unknown */ function wp_dashboard_recent_comments() { - $status = ( current_user_can('edit_posts') ) ? '' : 'approved'; + global $wpdb; - list($comments, $total) = _wp_get_comment_list( $status, false, 0, 5 ); + if ( current_user_can('edit_posts') ) + $allowed_states = array('0', '1'); + else + $allowed_states = array('1'); + + // Select all comment types and filter out spam later for better query performance. + $comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments ORDER BY comment_date_gmt DESC LIMIT 0, 50" ); if ( $comments ) : ?>
comment_approved, $allowed_states) ) + _wp_dashboard_recent_comments_row( $comment ); + } ?>