summaryrefslogtreecommitdiffstats
path: root/wp-admin/includes/dashboard.php
diff options
context:
space:
mode:
Diffstat (limited to 'wp-admin/includes/dashboard.php')
-rw-r--r--wp-admin/includes/dashboard.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php
index ea88ee4..97fd26a 100644
--- a/wp-admin/includes/dashboard.php
+++ b/wp-admin/includes/dashboard.php
@@ -23,7 +23,9 @@ function wp_dashboard_setup() {
/* Register Widgets and Controls */
// Recent Comments Widget
- if ( current_user_can( 'moderate_comments' ) && $mod_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'") ) {
+ $mod_comments = wp_count_comments();
+ $mod_comments = $mod_comments->moderated;
+ if ( current_user_can( 'moderate_comments' ) && $mod_comments ) {
$notice = sprintf( __ngettext( '%d comment awaiting moderation', '%d comments awaiting moderation', $mod_comments ), $mod_comments );
$notice = "<a href='edit-comments.php?comment_status=moderated'>$notice</a>";
} else {