Skip to content

Commit ced9c0f

Browse files
committed
Use the tag processor to correctly set script tag contents
1 parent fe6434d commit ced9c0f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/wp-includes/script-loader.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3006,6 +3006,12 @@ function wp_get_inline_script_tag( $data, $attributes = array() ) {
30063006
*/
30073007
$attributes = apply_filters( 'wp_inline_script_attributes', $attributes, $data );
30083008

3009+
$script_tag = sprintf( '<script%s></script>', wp_sanitize_script_attributes( $attributes ) );
3010+
$processor = new WP_HTML_Tag_Processor( $script_tag );
3011+
if ( $processor->next_tag( 'SCRIPT' ) && $processor->set_modifiable_text( $data ) ) {
3012+
return $processor->get_updated_html() . "\n";
3013+
}
3014+
30093015
return sprintf( "<script%s>%s</script>\n", wp_sanitize_script_attributes( $attributes ), $data );
30103016
}
30113017

0 commit comments

Comments
 (0)