Comments: Optimize the query for pending comments count in wp_notify_moderator() for better performance on large tables.

Props sgoen.
Fixes #48514.

git-svn-id: https://develop.svn.wordpress.org/trunk@46878 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-12-10 13:45:41 +00:00
parent 7ac5a9f003
commit 78feb00f7c

View File

@ -1739,7 +1739,7 @@ if ( ! function_exists( 'wp_notify_moderator' ) ) :
$comment_author_domain = gethostbyaddr( $comment->comment_author_IP );
}
$comments_waiting = $wpdb->get_var( "SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'" );
$comments_waiting = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'" );
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.