wp_kses_hair

SummerySummery

Builds an attribute list from string containing attributes.

Syntax

wp_kses_hair( string $attr, string[] $allowed_protocols )

DescriptionDescription

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').

ParametersParameters

$attr

(string) (Required) Attribute list from HTML element to closing HTML element tag.

$allowed_protocols

(string[]) (Required) Array of allowed URL protocols.

ReturnReturn

(array[]) Array of attribute information after parsing.

SourceSource

File: wp-includes/kses.php


			

ChangelogChangelog

Changelog
Version Description
1.0.0 Introduced.
Scroll to Top