wp_kses_data()WP 2.9.0

Sanitize content with allowed HTML Kses rules.

This function expects unslashed data.

Uses: wp_kses()
1 time — 0.000276 sec (fast) | 50000 times — 0.59 sec (very fast) | PHP 7.0.2, WP 4.4.1

No Hooks.

Return

String. Filtered content.

Usage

wp_kses_data( $data );
$data(string) (required)
Content to filter, expected to not be escaped.

Examples

0

#1 Demo

$str = '<div id="1st"><strong><i>Foo</i></strong><script>alert("passed");</script></div>'
echo wp_kses_data( $str );

// <strong><i>Foo</i></strong>alert("passed");

Changelog

Since 2.9.0 Introduced.

wp_kses_data() code WP 6.7.1

function wp_kses_data( $data ) {
	return wp_kses( $data, current_filter() );
}