WordPress.org

Ready to get started?Download WordPress

Codex

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

Function Reference/wp kses hair

Description

Builds an attribute list from string containing attributes.

This function does a lot of work. It parses an attribute list into an array with attribute data, and tries to do the right thing even if it gets weird input. It will add quotes around attribute values that don't have any quotes or apostrophes around them, to make it easier to produce HTML code that will conform to W3C's HTML specification. It will also remove bad URL protocols from attribute values. It also reduces duplicate attributes by using the attribute defined first (foo='bar' foo='baz' will result in foo='bar').

Usage

<?php wp_kses_hair$attr$allowed_protocols ?>

Parameters

$attr
(string) (required) Attribute list from HTML element to closing HTML element tag
Default: None
$allowed_protocols
(array) (required) Allowed protocols to keep
Default: None

Return Values

(array) 
List of attributes after parsing

Examples

Notes

Change Log

Since: 1.0.0

Source File

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

Related

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