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:

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.

Related Functions

wp_kses_one_attr, wp_kses_data, wp_kses_hair, wp_kses_attr_check, wp_kses_attr_parse

Top Google Results

User discussions

wpseek mobile