WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/wp kses attr

Description

Removes all attributes, if none are allowed for this element.

If some are allowed it calls wp_kses_hair() to split them further, and then it builds up new HTML code from the data that wp_kses_hair() returns. It also removes '<' and '>' characters, if there are any left. One more thing it does is to check if the tag has a closing XHTML slash, and if it does, it puts one in the returned code as well.

Usage

<?php wp_kses_attr$element$attr$allowed_html$allowed_protocols ?>

Parameters

$element
(string) (required) HTML element/tag
Default: None
$attr
(string) (required) HTML attributes from HTML element to closing HTML element tag
Default: None
$allowed_html
(array) (required) Allowed HTML elements
Default: None
$allowed_protocols
(array) (required) Allowed protocols to keep
Default: None

Return Values

(string) 
Sanitized HTML element

Examples

Notes

Change Log

Since: 1.0.0

Source File

wp_kses_attr() is located in wp-includes/kses.php.

Related

See also index of Function Reference and index of Template Tags.