Automattic\WooCommerce\Internal\Utilities

HtmlSanitizer::styled_post_contentpublicWC 1.0

Sanitizes a chunk of HTML, by following the same rules as wp_kses_post() also allowing the style element to be supplied.

Method of the class: HtmlSanitizer{}

No Hooks.

Returns

String.

Usage

$HtmlSanitizer = new HtmlSanitizer();
$HtmlSanitizer->styled_post_content( $html ): string;
$html(string) (required)
The HTML to be sanitized.

HtmlSanitizer::styled_post_content() code WC 10.3.5

public function styled_post_content( string $html ): string {
	$rules          = wp_kses_allowed_html( 'post' );
	$rules['style'] = true;
	return wp_kses( $html, $rules );
}