filter_block_kses() – Filters and sanitizes a parsed block to remove non-allowable HTML from block attribute values.

You appear to be a bot. Output may be restricted

Description

Filters and sanitizes a parsed block to remove non-allowable HTML from block attribute values.

Usage

$array = filter_block_kses( $block, $allowed_html, $allowed_protocols );

Parameters

$block
( WP_Block_Parser_Block ) required – The parsed block object.
$allowed_html
( array[]|string ) required – An array of allowed HTML elements and attributes, or a context name such as 'post'.
$allowed_protocols
( string[] ) optional – Allowed URL protocols.

Returns

array The filtered and sanitized block object result.

Source

File name: wordpress/wp-includes/blocks.php
Lines:

1 to 11 of 11
function filter_block_kses( $block, $allowed_html, $allowed_protocols = array() ) {
  $block['attrs'] = filter_block_kses_value( $block['attrs'], $allowed_html, $allowed_protocols );

  if ( is_array( $block['innerBlocks'] ) ) {
    foreach ( $block['innerBlocks'] as $i => $inner_block ) {
      $block['innerBlocks'][ $i ] = filter_block_kses( $inner_block, $allowed_html, $allowed_protocols );
    }
  }

  return $block;
}
 

 View on GitHub View on Trac