pre_kses хук-фильтрWP 2.3.0

Filters content to be run through KSES.

Использование

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(строка)
Content to filter through KSES.
$allowed_html(array[]|строка)
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.

Список изменений

С версии 2.3.0 Введена.

Где вызывается хук

wp_kses_hook()
pre_kses
wp-includes/kses.php 946
return apply_filters( 'pre_kses', $content, $allowed_html, $allowed_protocols );

Где используется хук в WordPress

wp-includes/default-filters.php 296
add_filter( 'pre_kses', 'wp_pre_kses_less_than' );
wp-includes/default-filters.php 297
add_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10, 3 );
wp-includes/formatting.php 5225
remove_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10 );
wp-includes/formatting.php 5227
add_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10, 3 );