wp_kses

Advertisement

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

$string

(Required) Text content to filter.

$allowed_html

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

$allowed_protocols

(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.

Advertisement

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

See also See also

Advertisement

Leave a Reply