pre_kses WordPress Filter Hook

The pre_kses hook is a filter hook that is called before kses is applied to content. It allows for customizing the kses rules before they are applied.

apply_filters( 'pre_kses', string $string, array[]|string $allowed_html, string[] $allowed_protocols ) #

Filters content to be run through KSES.


Parameters

$string

(string)Content to filter through KSES.

$allowed_html

(array[]|string)An array of allowed HTML elements and attributes, or a context name such as 'post'. See wp_kses_allowed_html() for the list of accepted context names.

$allowed_protocols

(string[])Array of allowed URL protocols.


Top ↑

More Information

KSES is a recursive acronym which stands for “KSES Strips Evil Scripts”.

The filter is used to change the types of HTML elements/attributes or context names are allowed in WordPress content, then strips any HTML elements/attributes that are registered as not allowed.


Top ↑

Source

File: wp-includes/kses.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
2.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.