filter_block_kses example


function filter_block_content( $text$allowed_html = 'post', $allowed_protocols = array() ) {
    $result = '';

    if ( str_contains( $text, '<!--' ) && str_contains( $text, '--->' ) ) {
        $text = preg_replace_callback( '%<!--(.*?)--->%', '_filter_block_content_callback', $text );
    }

    $blocks = parse_blocks( $text );
    foreach ( $blocks as $block ) {
        $block   = filter_block_kses( $block$allowed_html$allowed_protocols );
        $result .= serialize_block( $block );
    }

    return $result;
}

/** * Callback used for regular expression replacement in filter_block_content(). * * @private * @since 6.2.1 * * @param array $matches Array of preg_replace_callback matches. * @return string Replacement string. */
Home | Imprint | This part of the site doesn't use cookies.