Skip to content

Commit 609f322

Browse files
committed
Ensure content from script tags are properly removed
1 parent 4bd22bf commit 609f322

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

includes/Blocks/SharedBlock.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ function () use ( $block_support_styles ) {
146146
* Since the shortcodes and embed from the original source have already been processed, we temporarily allow
147147
* the `iframe` tag in the output.
148148
*/
149+
$html = preg_replace( '@<(script)[^>]*?>.*?</\\1>@si', '', $block_data['html'] );
149150
add_filter( 'wp_kses_allowed_html', [ Helpers::class, 'kses_post_iframe_tag' ], 10, 2 );
150-
$html = wp_kses_post( $block_data['html'] );
151+
$html = wp_kses_post( $html );
151152
remove_filter( 'wp_kses_allowed_html', [ Helpers::class, 'kses_post_iframe_tag' ] );
152153
return $html;
153154
}

0 commit comments

Comments
 (0)