Summery Summery

Filters text content and strips out disallowed HTML.

Syntax Syntax

wp_kses( string $string, array[]|string $allowed_html, string[] $allowed_protocols = array() )

Description Description

This function makes sure that only the allowed HTML element names, attribute names, attribute values, and HTML entities will occur in the given text string.

This function expects unslashed data.

Parameters Parameters


(Required) Text content to filter.


(Required) An array of allowed HTML elements and attributes, or a context name such as 'post'.


(Optional) Array of allowed URL protocols.

Default value: array()

Return Return

(string) Filtered content containing only the allowed HTML.

Source Source

File: wp-includes/kses.php

 * This function expects unslashed data.
 * @see wp_kses_post() for specifically filtering post content and fields.
 * @see wp_allowed_protocols() for the default allowed protocols in link URLs.
 * @since 1.0.0
 * @param string         $string            Text content to filter.


Changelog Changelog

Version Description
1.0.0 Introduced.

See also See also


Leave a Reply