Skip to content

Commit e74d3cf

Browse files
Use comment object ID after get_comment() call
The get_comment() return value is filtered, so reassign $comment_id from the comment object to ensure consistency between the property checks and subsequent function calls. Also removes a redundant null check on $comment.
1 parent bc0918c commit e74d3cf

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/wp-includes/comment.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2475,7 +2475,8 @@ function wp_new_comment_notify_postauthor( $comment_id ) {
24752475
if ( ! ( $comment instanceof WP_Comment ) ) {
24762476
return false;
24772477
}
2478-
$is_note = ( 'note' === $comment->comment_type );
2478+
$comment_id = $comment->comment_ID;
2479+
$is_note = ( 'note' === $comment->comment_type );
24792480

24802481
// By default, only notify for approved comments and notes.
24812482
if ( '1' !== $comment->comment_approved && ! $is_note ) {

0 commit comments

Comments
 (0)