wp_kses_allowed_html
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-includes/kses.php 1080
return apply_filters( 'wp_kses_allowed_html', $html, $context );
wp-includes/kses.php 1086
$tags = apply_filters( 'wp_kses_allowed_html', $allowedposttags, $context );
wp-includes/kses.php 1103
$tags = apply_filters( 'wp_kses_allowed_html', $tags, $context );
wp-includes/kses.php 1115
return apply_filters( 'wp_kses_allowed_html', $tags, $context );
wp-includes/kses.php 1119
return apply_filters( 'wp_kses_allowed_html', array(), $context );
wp-includes/kses.php 1123
return apply_filters( 'wp_kses_allowed_html', $allowedentitynames, $context );
wp-includes/kses.php 1128
return apply_filters( 'wp_kses_allowed_html', $allowedtags, $context );
Where the hook is used in WordPress
wp-includes/class-wp-customize-widgets.php 1801
add_filter( 'wp_kses_allowed_html', array( $this, 'filter_wp_kses_allowed_data_attributes' ) );