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 832
return apply_filters( 'wp_kses_allowed_html', $html, $context );
wp-includes/kses.php 838
$tags = apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context );
wp-includes/kses.php 855
$tags = apply_filters( 'wp_kses_allowed_html', $tags, $context );
wp-includes/kses.php 865
return apply_filters( 'wp_kses_allowed_html', $tags, $context );
wp-includes/kses.php 869
return apply_filters( 'wp_kses_allowed_html', array(), $context );
wp-includes/kses.php 873
return apply_filters( 'wp_kses_allowed_html', $allowedentitynames, $context );
wp-includes/kses.php 878
return apply_filters( 'wp_kses_allowed_html', $allowedtags, $context );

Where the hook is used in WordPress

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