File tree Expand file tree Collapse file tree 3 files changed +15
-14
lines changed
Expand file tree Collapse file tree 3 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -2458,19 +2458,6 @@ function wp_new_comment_notify_postauthor( $comment_id ) {
24582458 return wp_notify_postauthor ( $ comment_id );
24592459}
24602460
2461- /**
2462- * Send a notification to the post author when a new note is added via the REST API.
2463- *
2464- * @since 6.9.0
2465- *
2466- * @param WP_Comment $comment The comment object.
2467- */
2468- function wp_new_comment_via_rest_notify_postauthor ( $ comment ) {
2469- if ( 'note ' === $ comment ->comment_type ) {
2470- wp_new_comment_notify_postauthor ( $ comment ->comment_ID );
2471- }
2472- }
2473-
24742461/**
24752462 * Sets the status of a comment.
24762463 *
Original file line number Diff line number Diff line change 522522// Email notifications.
523523add_action ( 'comment_post ' , 'wp_new_comment_notify_moderator ' );
524524add_action ( 'comment_post ' , 'wp_new_comment_notify_postauthor ' );
525- add_action ( 'rest_insert_comment ' , ' wp_new_comment_via_rest_notify_postauthor ' );
525+ add_action ( 'rest_insert_comment ' , array ( ' WP_REST_Comments_Controller ' , ' wp_new_comment_via_rest_notify_postauthor ' ) );
526526add_action ( 'after_password_reset ' , 'wp_password_change_notification ' );
527527add_action ( 'register_new_user ' , 'wp_send_new_user_notifications ' );
528528add_action ( 'edit_user_created_user ' , 'wp_send_new_user_notifications ' , 10 , 2 );
Original file line number Diff line number Diff line change @@ -36,6 +36,20 @@ public function __construct() {
3636 $ this ->meta = new WP_REST_Comment_Meta_Fields ();
3737 }
3838
39+ /**
40+ * Send a notification to the post author when a new note is added via the REST API.
41+ *
42+ * @since 6.9.0
43+ *
44+ * @param WP_Comment $comment The comment object.
45+ */
46+ public static function wp_new_comment_via_rest_notify_postauthor ( $ comment ) {
47+ if ( 'note ' === $ comment ->comment_type ) {
48+ wp_new_comment_notify_postauthor ( $ comment ->comment_ID );
49+ }
50+ }
51+
52+
3953 /**
4054 * Registers the routes for comments.
4155 *
You can’t perform that action at this time.
0 commit comments