wp_kses_attr
wp_kses_attr ( $element, $attr, $allowed_html, $allowed_protocols )
Parameters:- (string) element HTML element/tag.
- (string) attr HTML attributes from HTML element to closing HTML element tag.
- (array[]|string) allowed_html 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.
- (string[]) allowed_protocols Array of allowed URL protocols.
Returns:- (string) Sanitized HTML element.
Defined at: - Introduced in WordPress: 1.0.0
- Deprecated in WordPress: —
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 `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.