wp_kses_attr

SummerySummery

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

Syntax

wp_kses_attr( string $element, string $attr, array $allowed_html, string[] $allowed_protocols )

DescriptionDescription

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

ParametersParameters

$element

(string) (Required) HTML element/tag.

$attr

(string) (Required) HTML attributes from HTML element to closing HTML element tag.

$allowed_html

(array) (Required) Allowed HTML elements.

$allowed_protocols

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

ReturnReturn

(string) Sanitized HTML element.

SourceSource

File: wp-includes/kses.php


			

ChangelogChangelog

Changelog
Version Description
1.0.0 Introduced.
Scroll to Top