Removes non-allowable HTML from parsed block attribute values when filtering in the post context.
$contentstringrequired
$allowed_htmlarray[]|stringrequired
'post'.$allowed_protocolsstring[]required
function wp_pre_kses_block_attributes( $content, $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 );
$content = filter_block_content( $content, $allowed_html, $allowed_protocols );
add_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10, 3 );
return $content;
}
| Version | Description |
|---|---|
| 5.3.1 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_pre_kses_block_attributes