wp_kses_allowed_html filter-hookWP 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.

Usage

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;
}
$html(array[])
Allowed HTML tags.
$context(string)
Context name.

Changelog

Since 3.5.0 Introduced.

Where the hook is called

wp_kses_allowed_html()
wp_kses_allowed_html
wp-includes/kses.php 869
return apply_filters( 'wp_kses_allowed_html', $html, $context );
wp-includes/kses.php 875
$tags = apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context );
wp-includes/kses.php 892
$tags = apply_filters( 'wp_kses_allowed_html', $tags, $context );
wp-includes/kses.php 902
return apply_filters( 'wp_kses_allowed_html', $tags, $context );
wp-includes/kses.php 906
return apply_filters( 'wp_kses_allowed_html', array(), $context );
wp-includes/kses.php 910
return apply_filters( 'wp_kses_allowed_html', $allowedentitynames, $context );
wp-includes/kses.php 915
return apply_filters( 'wp_kses_allowed_html', $allowedtags, $context );

Where the hook is used in WordPress

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