diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php index 217d18d8275a0..9ef4078f89054 100644 --- a/src/wp-admin/includes/schema.php +++ b/src/wp-admin/includes/schema.php @@ -563,7 +563,6 @@ function populate_options( array $options = array() ) { // 6.9.0 'wp_notes_notify' => 1, - ); // 3.3.0 diff --git a/src/wp-admin/options-discussion.php b/src/wp-admin/options-discussion.php index 3b4e1ac3a2313..0c350475fe176 100644 --- a/src/wp-admin/options-discussion.php +++ b/src/wp-admin/options-discussion.php @@ -162,7 +162,7 @@
diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php index a6deb2db599f5..49c9c6b2cb966 100644 --- a/src/wp-includes/comment.php +++ b/src/wp-includes/comment.php @@ -2427,7 +2427,7 @@ function wp_new_comment_notify_postauthor( $comment_id ) { $comment = get_comment( $comment_id ); $is_note = ( $comment && 'note' === $comment->comment_type ); - $maybe_notify = $is_note ? get_option( 'wp_notes_notify' ) : get_option( 'comments_notify' ); + $maybe_notify = $is_note ? get_option( 'wp_notes_notify', 1 ) : get_option( 'comments_notify' ); /** * Filters whether to send the post author new comment notification emails, @@ -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 ( $comment instanceof WP_Comment && 'note' === $comment->comment_type ) { + wp_new_comment_notify_postauthor( (int) $comment->comment_ID ); + } +} + /** * Sets the status of a comment. * diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php index 58ee4053e0752..68dccd979f2fe 100644 --- a/src/wp-includes/default-filters.php +++ b/src/wp-includes/default-filters.php @@ -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 ); diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php index 0ef02aae4d0dc..7fe79b57c1b9b 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php @@ -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. *