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 unslashed data.
Parameters
$datastringrequired- Post content to filter.
Source
function wp_kses_post( $data ) {
return wp_kses( $data, 'post' );
}
Changelog
| Version | Description |
|---|---|
| 2.9.0 | Introduced. |
Display Admin notice
The following example of basic usage of the
wp_kses_post()function. We can use it to print the message in the admin screen.public function field_message() { $opts = $this->get_options(); ?> <textarea name="[message]" rows="3" class="large-text"> <?php } private function render_bar( $opts ) { $message = apply_filters( 'sabw_alert_message', $opts['message'], $opts ); echo ''; echo wp_kses_post( $message ); echo ''; do_action( 'sabw_rendered_alert', $opts ); }