wp_kses_data( string $data )
Sanitize content with allowed HTML KSES rules.
Description Description
This function expects unslashed data.
Parameters Parameters
- $data
-
(string) (Required) Content to filter, expected to not be escaped.
Return Return
(string) Filtered content.
Source Source
File: wp-includes/kses.php
function wp_kses_data( $data ) {
return wp_kses( $data, current_filter() );
}
Expand full source code Collapse full source code View on Trac
Changelog Changelog
| Version | Description |
|---|---|
| 2.9.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Example
Below example sanitizes input HTML string by removing non allowed tag <div> and <script>.
$s = '<div id="1st"><strong><i>Foo</i></strong><script>alert("Bar");</script></div>'; $x = wp_kses_data($s); // Now, $x is <strong><i>Foo</i></strong>alert("Bar");