diff --git a/src/wp-includes/comment-functions.php b/src/wp-includes/comment-functions.php index 2de0322865..155e7b4da0 100644 --- a/src/wp-includes/comment-functions.php +++ b/src/wp-includes/comment-functions.php @@ -1646,13 +1646,14 @@ function wp_new_comment( $commentdata ) { * * @since 4.4.0 * - * @param int $comment_ID ID of the comment. - * @param int $comment_approved Whether the comment is approved. + * @param int $comment_ID ID of the comment. * @return bool True on success, false on failure. */ -function wp_new_comment_notify_moderator( $comment_ID, $comment_approved ) { +function wp_new_comment_notify_moderator( $comment_ID ) { + $comment = get_comment( $comment_ID ); + // Only send notifications for pending comments. - if ( '0' != $comment_approved ) { + if ( '0' != $comment->comment_approved ) { return false; } diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php index 4081be43c1..f9fd9c47c9 100644 --- a/src/wp-includes/default-filters.php +++ b/src/wp-includes/default-filters.php @@ -336,7 +336,7 @@ add_action( 'split_shared_term', '_wp_check_split_nav_menu_terms', 10, 4 ); add_action( 'wp_split_shared_term_batch', '_wp_batch_split_terms' ); // Email notifications. -add_action( 'comment_post', 'wp_new_comment_notify_moderator', 10, 2 ); +add_action( 'comment_post', 'wp_new_comment_notify_moderator' ); add_action( 'comment_post', 'wp_new_comment_notify_postauthor' ); add_action( 'after_password_reset', 'wp_password_change_notification' ); add_action( 'register_new_user', 'wp_send_new_user_notifications' );