Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/wp-includes/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -2458,6 +2458,19 @@ function wp_new_comment_notify_postauthor( $comment_id ) {
return wp_notify_postauthor( $comment_id );
}

/**
* Send a notification to the post author when a new note is added via the REST API.
*
* @since 6.9.0
*
* @param WP_Comment $comment The comment object.
*/
function wp_new_comment_via_rest_notify_postauthor( $comment ) {
if ( 'note' === $comment->comment_type ) {
wp_new_comment_notify_postauthor( $comment->comment_ID );
}
}

/**
* Sets the status of a comment.
*
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/default-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@
// Email notifications.
add_action( 'comment_post', 'wp_new_comment_notify_moderator' );
add_action( 'comment_post', 'wp_new_comment_notify_postauthor' );
add_action( 'rest_insert_comment', array( 'WP_REST_Comments_Controller', 'wp_new_comment_via_rest_notify_postauthor' ) );
add_action( 'rest_insert_comment', 'wp_new_comment_via_rest_notify_postauthor' );
add_action( 'after_password_reset', 'wp_password_change_notification' );
add_action( 'register_new_user', 'wp_send_new_user_notifications' );
add_action( 'edit_user_created_user', 'wp_send_new_user_notifications', 10, 2 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ public function __construct() {
$this->meta = new WP_REST_Comment_Meta_Fields();
}

/**
* Send a notification to the post author when a new note is added via the REST API.
*
* @since 6.9.0
*
* @param WP_Comment $comment The comment object.
*/
public static function wp_new_comment_via_rest_notify_postauthor( $comment ) {
if ( 'note' === $comment->comment_type ) {
wp_new_comment_notify_postauthor( $comment->comment_ID );
}
}
/**
* Registers the routes for comments.
*
Expand Down
Loading