Filter hook 'wp_kses_allowed_html'

in WP Core File wp-includes/kses.php at line 917

View Source

wp_kses_allowed_html

Filter Hook
Description
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.

Hook Information

File Location wp-includes/kses.php View on GitHub
Hook Type Filter
Line Number 917

Hook Parameters

Type Name Description
array[] $html Allowed HTML tags.
string $context Context name.

Usage Examples

Basic Usage
<?php
// Hook into wp_kses_allowed_html
add_filter('wp_kses_allowed_html', 'my_custom_filter', 10, 2);

function my_custom_filter($html, $context) {
    // Your custom filtering logic here
    return $html;
}

Source Code Context

wp-includes/kses.php:917 - How this hook is used in WordPress core
<?php
 912  			return apply_filters( 'wp_kses_allowed_html', $allowedentitynames, $context );
 913  
 914  		case 'data':
 915  		default:
 916  			/** This filter is documented in wp-includes/kses.php */
 917  			return apply_filters( 'wp_kses_allowed_html', $allowedtags, $context );
 918  	}
 919  }
 920  
 921  /**
 922   * You add any KSES hooks here.

PHP Documentation

<?php
/**
		 * 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.
		 *
		 * @since 3.5.0
		 *
		 * @param array[] $html    Allowed HTML tags.
		 * @param string  $context Context name.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/kses.php
Related Hooks

Related hooks will be displayed here in future updates.