Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_pre_kses_block_attributes ›

Seit5.3.1
Veraltetn/v
wp_pre_kses_block_attributes ( $string, $allowed_html, $allowed_protocols )
Parameter: (3)
  • (string) $string Content to be run through KSES.
    Erforderlich: Ja
  • (array[]|string) $allowed_html An array of allowed HTML elements and attributes, or a context name such as 'post'.
    Erforderlich: Ja
  • (string[]) $allowed_protocols Array of allowed URL protocols.
    Erforderlich: Ja
Gibt zurück:
  • (string) Filtered text to run through KSES.
Definiert in:
Codex:

Remove non-allowable HTML from parsed block attribute values when filtering in the post context.



Quellcode

function wp_pre_kses_block_attributes( $string, $allowed_html, $allowed_protocols ) {
	/*
	 * `filter_block_content` is expected to call `wp_kses`. Temporarily remove
	 * the filter to avoid recursion.
	 */
	remove_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10 );
	$string = filter_block_content( $string, $allowed_html, $allowed_protocols );
	add_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10, 3 );

	return $string;
}