_wp_kses_allow_note_mention_span()WP 7.1.0

Allows the note mention chip markup in comment content.

The notes @ mention completer stores a mention as a chip carrying the mentioned user's ID in a class token: <span class="wp-note-mention user-N">@Name</span>. The default comment allowlist does not allow span at all, so for users without unfiltered_html the mention would be stripped on save.

The allowance is deliberately narrow and always on: span is a semantics-free element and _wp_kses_sanitize_note_mention_classes() reduces its class to the two mention tokens right after kses runs, so regular (including anonymous) commenters gain nothing beyond the inert mention markup itself.

Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.

Хуков нет.

Возвращает

array<string,. array<string, bool>> Modified allowed tags structure.

Использование

_wp_kses_allow_note_mention_span( $allowed, $context ): array;
$allowed(обязательный)
.
$context(строка) (обязательный)
The kses context.

Список изменений

С версии 7.1.0 Введена.

Код _wp_kses_allow_note_mention_span() WP 7.1.2

function _wp_kses_allow_note_mention_span( $allowed, $context ): array {
	if ( ! is_array( $allowed ) ) {
		$allowed = array();
	}
	if ( 'pre_comment_content' !== $context ) {
		return $allowed;
	}

	if ( ! isset( $allowed['span'] ) || ! is_array( $allowed['span'] ) ) {
		$allowed['span'] = array();
	}

	$allowed['span']['class'] = true;

	return $allowed;
}