Title: wp_notify_note_mentions
Published: August 20, 2026

---

# wp_notify_note_mentions( WP_Comment|null $comment, mixed $request = null, bool $creating = true )

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_notify_note_mentions/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_notify_note_mentions/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/wp_notify_note_mentions/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_notify_note_mentions/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_notify_note_mentions/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_notify_note_mentions/?output_format=md#wp--skip-link--target)

Notifies mentioned users about a new note.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_notify_note_mentions/?output_format=md#description)󠁿

Runs on [‘rest_insert_comment’](https://developer.wordpress.org/reference/hooks/rest_insert_comment/)
alongside the post author notification.
The recipient set is the users mentioned
in this note, minus the note’s own author (a user is not notified about their own
note) and the post author, who is already notified about every note by [wp_new_comment_via_rest_notify_postauthor()](https://developer.wordpress.org/reference/functions/wp_new_comment_via_rest_notify_postauthor/).

Only fires when a note is created, not when an existing one is edited, so correcting
a note does not re-notify everyone who already received it.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_notify_note_mentions/?output_format=md#parameters)󠁿

 `$comment`[WP_Comment](https://developer.wordpress.org/reference/classes/wp_comment/)
|nullrequired

The note that was just inserted. (May only be null as an edge case.)

`$request`mixedoptional

The REST request. Unused.

Default:`null`

`$creating`booloptional

Whether this is a create (true) or update (false).

Default:`true`

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_notify_note_mentions/?output_format=md#source)󠁿

    ```php
    function 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 );
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/comment.php#L2654)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/comment.php#L2654-L2711)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_notify_note_mentions/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_get_note_mentioned_user_ids()](https://developer.wordpress.org/reference/functions/wp_get_note_mentioned_user_ids/)`wp-includes/comment.php` |

Extracts the mentioned user IDs from note content.

  | 
| [wp_send_note_notification()](https://developer.wordpress.org/reference/functions/wp_send_note_notification/)`wp-includes/comment.php` |

Sends a single note mention notification email.

  | 
| [user_can()](https://developer.wordpress.org/reference/functions/user_can/)`wp-includes/capabilities.php` |

Returns whether a particular user has the specified capability.

  | 
| [get_userdata()](https://developer.wordpress.org/reference/functions/get_userdata/)`wp-includes/pluggable.php` |

Retrieves user info by user ID.

  | 
| [get_option()](https://developer.wordpress.org/reference/functions/get_option/)`wp-includes/option.php` |

Retrieves an option value based on an option name.

  | 
| [get_post()](https://developer.wordpress.org/reference/functions/get_post/)`wp-includes/post.php` |

Retrieves post data given a post ID or post object.

  |

[Show 3 more](https://developer.wordpress.org/reference/functions/wp_notify_note_mentions/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_notify_note_mentions/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_notify_note_mentions/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.1.0](https://developer.wordpress.org/reference/since/7.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_notify_note_mentions%2F)
before being able to contribute a note or feedback.