wp-includes/comment.php:2654Notifies mentioned users about a new note.
$commentWP_Comment|null$requestmixedoptionalnull$creatingbooloptionaltruefunction wp_notify_note_mentions( ?WP_Comment $comment, $request = null, bool $creating = true ): void { if ( ! $creating || ! $comment ) { return; } if ( 'note' !== $comment->comment_type ) { return; } // Share the single user-facing notes notification preference. if ( ! get_option( 'wp_notes_notify', 1 ) ) { return; } $mentioned = wp_get_note_mentioned_user_ids( $comment->comment_content ); $author_id = (int) $comment->user_id; $comment_post_id = (int) $comment->comment_post_ID; $post = $comment_post_id ? get_post( $comment_post_id ) : null; $post_author_id = $post ? (int) $post->post_author : 0; /* * The recipient set is bounded and small (one note's mentions), so emails * are sent synchronously here. If notification volume ever warrants it, * the right fix is to offload delivery to a background queue rather than * throttle within the request. */ foreach ( $mentioned as $user_id ) { // Never notify the author about their own note. if ( $user_id === $author_id ) { continue; } // The post author is already notified of every note. if ( $user_id === $post_author_id ) { continue; } $user = get_userdata( $user_id ); if ( ! $user || empty( $user->user_email ) ) { continue; } /* * Only notify users who can actually read the note. Notes are * internal: WP_REST_Comments_Controller::check_read_permission() * only exposes a note to its author or to users who can edit it, so * the email audience is held to the same bar. A plain read_post * check would leak note content to, for example, subscribers on a * public post, who cannot see the note in the editor. */ if ( ! user_can( $user_id, 'edit_comment', $comment->comment_ID ) ) { continue; } wp_send_note_notification( $user, $comment, $post ); }}Introduced in 7.1.0.
Signature, return type and hooks compared across 1 parsed release.
src/wp-includes/comment.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.