wp_filter_post_kses() WordPress Function
The wp_filter_post_kses() function is used to filter data from posts and comments before inserting them into the database. This function strips all unwanted tags and attributes from the data, which helps to protect your site from malicious code.
wp_filter_post_kses( string $data ) #
Sanitizes content for allowed HTML tags for post content.
Description
Post content refers to the page contents of the ‘post’ type and not $_POST
data from forms.
This function expects slashed data.
Parameters
- $data
(string)(Required)Post content to filter, expected to be escaped with slashes.
Return
(string) Filtered post content with allowed HTML tags and attributes intact.
Source
File: wp-includes/kses.php
function wp_filter_post_kses( $data ) { return addslashes( wp_kses( stripslashes( $data ), 'post' ) ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.0.0 | Introduced. |