pre_kses
Filters content to be run through KSES.
Usage
add_filter( 'pre_kses', 'wp_kama_pre_kses_filter', 10, 3 ); /** * Function for `pre_kses` filter-hook. * * @param string $content Content to filter through KSES. * @param array[]|string $allowed_html An array of allowed HTML elements and attributes, or a context name such as 'post'. See wp_kses_allowed_html() for the list of accepted context names. * @param string[] $allowed_protocols Array of allowed URL protocols. * * @return string */ function wp_kama_pre_kses_filter( $content, $allowed_html, $allowed_protocols ){ // filter... return $content; }
- $content(string)
- Content to filter through KSES.
- $allowed_html(array[]|string)
- An array of allowed HTML elements and attributes, or a context name such as 'post'. See wp_kses_allowed_html() for the list of accepted context names.
- $allowed_protocols(string[])
- Array of allowed URL protocols.
Changelog
Since 2.3.0 | Introduced. |
Where the hook is called
pre_kses
wp-includes/kses.php 946
return apply_filters( 'pre_kses', $content, $allowed_html, $allowed_protocols );
Where the hook is used in WordPress
wp-includes/default-filters.php 297
add_filter( 'pre_kses', 'wp_pre_kses_less_than' );
wp-includes/default-filters.php 298
add_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10, 3 );
wp-includes/formatting.php 5214
remove_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10 );
wp-includes/formatting.php 5216
add_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10, 3 );