kses_init_filters() WordPress Function

The kses_init_filters() function initializes the kses filtering system. This function must be called before any other kses functions will work.

kses_init_filters() #

Adds all KSES input form content filters.


Description

All hooks have default priority. The wp_filter_kses() function is added to the ‘pre_comment_content’ and ‘title_save_pre’ hooks.

The wp_filter_post_kses() function is added to the ‘content_save_pre’, ‘excerpt_save_pre’, and ‘content_filtered_save_pre’ hooks.


Top ↑

Source

File: wp-includes/kses.php

function kses_init_filters() {
	// Normal filtering.
	add_filter( 'title_save_pre', 'wp_filter_kses' );

	// Comment filtering.
	if ( current_user_can( 'unfiltered_html' ) ) {
		add_filter( 'pre_comment_content', 'wp_filter_post_kses' );
	} else {
		add_filter( 'pre_comment_content', 'wp_filter_kses' );
	}

	// Global Styles filtering: Global Styles filters should be executed before normal post_kses HTML filters.
	add_filter( 'content_save_pre', 'wp_filter_global_styles_post', 9 );
	add_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post', 9 );

	// Post filtering.
	add_filter( 'content_save_pre', 'wp_filter_post_kses' );
	add_filter( 'excerpt_save_pre', 'wp_filter_post_kses' );
	add_filter( 'content_filtered_save_pre', 'wp_filter_post_kses' );
}


Top ↑

Changelog

Changelog
VersionDescription
2.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.