kses_remove_filters() WordPress Function

The kses_remove_filters() function is used to remove kses filters from a specified content type. This function is useful for removing unwanted kses filters from content that is being imported from an external source.

kses_remove_filters() #

Removes all KSES input form content filters.


Description

A quick procedural method to removing all of the filters that KSES uses for content in WordPress Loop.

Does not remove the kses_init() function from ‘init’ hook (priority is default). Also does not remove kses_init() function from ‘set_current_user’ hook (priority is also default).


Top ↑

Source

File: wp-includes/kses.php

function kses_remove_filters() {
	// Normal filtering.
	remove_filter( 'title_save_pre', 'wp_filter_kses' );

	// Comment filtering.
	remove_filter( 'pre_comment_content', 'wp_filter_post_kses' );
	remove_filter( 'pre_comment_content', 'wp_filter_kses' );

	// Global Styles filtering.
	remove_filter( 'content_save_pre', 'wp_filter_global_styles_post', 9 );
	remove_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post', 9 );

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


Top ↑

Changelog

Changelog
VersionDescription
2.0.6Introduced.

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.