Removes all KSES input form content filters.


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 ↑


File: wp-includes/kses.php. View all references

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 ↑


Version Description
2.0.6 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by a4jp

    Notes: KSES is a recursive acronym which stands for “KSES Strips Evil Scripts”. KSES is an HTML/XHTML filter written in PHP. It removes all unwanted HTML elements and attributes, and it also does several checks on attribute values. KSES can be used to avoid Cross-Site Scripting (XSS).

You must log in before being able to contribute a note or feedback.