wp_kses_allowed_html хук-фильтрWP 3.5.0

Filters the HTML tags that are allowed for a given context.

HTML tags and attribute names are case-insensitive in HTML but must be added to the KSES allow list in lowercase. An item added to the allow list in upper or mixed case will not recognized as permitted by KSES.


add_filter( 'wp_kses_allowed_html', 'wp_kama_kses_allowed_html_filter', 10, 2 );

 * Function for `wp_kses_allowed_html` filter-hook.
 * @param array[] $html    Allowed HTML tags.
 * @param string  $context Context name.
 * @return array[]
function wp_kama_kses_allowed_html_filter( $html, $context ){

	// filter...
	return $html;
Allowed HTML tags.
Context name.

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

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

Где вызывается хук

wp-includes/kses.php 833
return apply_filters( 'wp_kses_allowed_html', $html, $context );
wp-includes/kses.php 839
$tags = apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context );
wp-includes/kses.php 856
$tags = apply_filters( 'wp_kses_allowed_html', $tags, $context );
wp-includes/kses.php 866
return apply_filters( 'wp_kses_allowed_html', $tags, $context );
wp-includes/kses.php 870
return apply_filters( 'wp_kses_allowed_html', array(), $context );
wp-includes/kses.php 874
return apply_filters( 'wp_kses_allowed_html', $allowedentitynames, $context );
wp-includes/kses.php 879
return apply_filters( 'wp_kses_allowed_html', $allowedtags, $context );

Где используется хук в WordPress

wp-includes/class-wp-customize-widgets.php 1760
add_filter( 'wp_kses_allowed_html', array( $this, 'filter_wp_kses_allowed_data_attributes' ) );