Make WordPress Core


Ignore:
Timestamp:
08/04/2026 09:30:53 PM (4 weeks ago)
Author:
adamsilverstein
Message:

Comments: Notify users mentioned in a note.

Introduce wp_notify_note_mentions() on rest_insert_comment, alongside the existing post author notification, which parses those IDs out of the saved note and emails each mentioned user in their own locale with a link back to the post editor.

Recipients are limited to users who can edit_comment the note, matching WP_REST_Comments_Controller::check_read_permission(), so an email cannot carry note content to someone who cannot see the note in the editor. The note's own author is skipped, as is the post author, who wp_new_comment_via_rest_notify_postauthor() already notifies about every note. Only note creation notifies, and the existing wp_notes_notify option turns the whole path off.

See related Gutenberg pull request: https://github.com/WordPress/gutenberg/pull/79606.

Follow-up to [62832].

Props westonruter, mamaduka.
Fixes #65639.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-filters.php

    r62970 r63012  
    537537add_action( 'comment_post', 'wp_new_comment_notify_postauthor' );
    538538add_action( 'rest_insert_comment', 'wp_new_comment_via_rest_notify_postauthor' );
     539add_action( 'rest_insert_comment', 'wp_notify_note_mentions', 10, 3 );
    539540add_action( 'after_password_reset', 'wp_password_change_notification' );
    540541add_action( 'register_new_user', 'wp_send_new_user_notifications' );
Note: See TracChangeset for help on using the changeset viewer.