diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php index a6deb2db599f5..145cf91a7c129 100644 --- a/src/wp-includes/comment.php +++ b/src/wp-includes/comment.php @@ -2429,9 +2429,17 @@ function wp_new_comment_notify_postauthor( $comment_id ) { $maybe_notify = $is_note ? get_option( 'wp_notes_notify' ) : get_option( 'comments_notify' ); + // By default, only notify for approved comments and notes. + if ( + ! isset( $comment->comment_approved ) || + ( '1' !== $comment->comment_approved && ! $is_note ) ) { + $maybe_notify = false; + } + /** - * Filters whether to send the post author new comment notification emails, - * overriding the site setting. + * Filters whether to send the post author new comment and note notification emails, + * overriding the site settings and defaults. By default, notifications are sent for + * all notes and for approved comments. * * @since 4.4.0 * @@ -2448,13 +2456,6 @@ function wp_new_comment_notify_postauthor( $comment_id ) { return false; } - // Send notifications for approved comments and all notes. - if ( - ! isset( $comment->comment_approved ) || - ( '1' !== $comment->comment_approved && ! $is_note ) ) { - return false; - } - return wp_notify_postauthor( $comment_id ); }