Skip to content

Commit 9adf0e5

Browse files
Apply suggestions from Weston
Co-authored-by: Weston Ruter <[email protected]>
1 parent 7c217dd commit 9adf0e5

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/wp-includes/comment.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2472,13 +2472,13 @@ function wp_new_comment_notify_moderator( $comment_id ) {
24722472
*/
24732473
function wp_new_comment_notify_postauthor( $comment_id ) {
24742474
$comment = get_comment( $comment_id );
2475+
if ( ! ( $comment instanceof WP_Comment ) ) {
2476+
return false;
2477+
}
24752478
$is_note = ( $comment && 'note' === $comment->comment_type );
24762479

24772480
// By default, only notify for approved comments and notes.
2478-
if (
2479-
! isset( $comment->comment_approved ) ||
2480-
( '1' !== $comment->comment_approved && ! $is_note )
2481-
) {
2481+
if ( '1' !== $comment->comment_approved && ! $is_note ) {
24822482
$maybe_notify = false;
24832483
} else if ( $is_note ) {
24842484
$maybe_notify = get_option( 'wp_notes_notify', 1 );

0 commit comments

Comments
 (0)