You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Notes: mention markup is stripped by kses when a note is created via the REST API #80258
Follow-up to #79604. The mention kses scoping added there never fires when a note is created through the REST API, so for users without unfiltered_html, the <a class="wp-note-mention user-N"> markup is silently stripped on save.
Neither of the two arming hooks runs on the REST create path:
gutenberg_notes_scope_mention_kses_rest() (on rest_preprocess_comment) does not arm because WP_REST_Comments_Controller::create_item() only copies the type param into the prepared data afterprepare_item_for_database() has run, so the filter sees no comment type (and no id to resolve one from).
The preprocess_comment arm does not fire either, because create_item() inserts via wp_insert_comment( wp_filter_comment( ... ) ) directly and never calls wp_new_comment().
As a result, creating a note with a mention as an author or contributor (or as anyone but a super admin on multisite) strips the mention classes. This breaks mention chips in the UI and will break mention notifications once #79606 lands.
Step-by-step reproduction instructions
As a user without unfiltered_html (e.g. an author) on a post they can edit, open the editor and add a note that @-mentions another user.
Save and reload the post.
The mention renders as a plain link - the wp-note-mention user-N classes have been stripped, so the mention chip is lost.
Expected behaviour
The mention markup survives saving regardless of the user's unfiltered_html capability, and the mention chip renders after reload.
Actual behaviour
kses strips the mention classes on REST note creation, so the mention degrades to a plain link.
Activity