wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_interactivity_as_dangerous_html › WordPress Function

Since7.2.0
Deprecatedn/a
› wp_interactivity_as_dangerous_html ( $html )
Parameters:
  • (string) $html The HTML to mark as trusted. It is not sanitized.
    Required: Yes
Returns:
  • (WP_Interactivity_Dangerous_HTML) The token that carries the HTML.
Defined at:
Codex:

Marks an HTML string as trusted, for `data-wp-html` to render as the content of an element.

The returned token is the only value data-wp-html renders in server directive processing. Warning: this function does not sanitize the HTML. Passing untrusted input, such as user-submitted content, creates a cross-site scripting (XSS) vulnerability. Sanitize it first, for example with wp_kses_post(), or build it only from trusted markup. A value read from context must never become a token, directly or after being copied into state. Context selects and state supplies: context is controlled by the client or by markup, so it may only select among tokens that server-side code created, and must never be the HTML a token is created from.


Source

function wp_interactivity_as_dangerous_html( string $html ): WP_Interactivity_Dangerous_HTML {
	return new WP_Interactivity_Dangerous_HTML( $html );
}