W3cubDocs

/WordPress

wp_kses_post( string $data ): string

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.

Return

string Filtered post content with allowed HTML tags and attributes intact.

Source

function wp_kses_post( $data ) {
	return wp_kses( $data, 'post' );
}

Changelog

Version Description
2.9.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_kses_post