WC_Helper_Sanitization::sanitize_html
Sanitize HTML content allowing a subset of SVG elements.
Method of the class: WC_Helper_Sanitization{}
No Hooks.
Returns
String. Sanitized HTML with SVG support.
Usage
$result = WC_Helper_Sanitization::sanitize_html( $html );
- $html(string) (required)
- The HTML to sanitize.
WC_Helper_Sanitization::sanitize_html() WC Helper Sanitization::sanitize html code WC 10.3.3
public static function sanitize_html( $html ) {
$allowed_html = wp_kses_allowed_html( 'post' );
// Selected SVG tags and attributes.
$svg_tags = self::wc_kses_safe_svg_tags();
$allowed_html = array_merge( $allowed_html, $svg_tags );
return wp_kses( self::wc_pre_sanitize_svg( $html ), $allowed_html );
}