Skip to content

Commit 8507d59

Browse files
committed
Use HTML Tag Processor for STYLE tags in theme.json
1 parent aa7852c commit 8507d59

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/wp-includes/theme.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,11 +1953,13 @@ function _custom_background_cb() {
19531953

19541954
$style .= $image . $position . $size . $repeat . $attachment;
19551955
}
1956-
?>
1957-
<style<?php echo $type_attr; ?> id="custom-background-css">
1958-
body.custom-background { <?php echo trim( $style ); ?> }
1959-
</style>
1960-
<?php
1956+
1957+
$processor = new WP_HTML_Tag_Processor( "<style{$type_attr} id=\"custom-background-css\"></style>" );
1958+
$processor->next_tag();
1959+
1960+
$style_tag_content = 'body.custom-background { ' . trim( $style ) . ' }';
1961+
$processor->set_modifiable_text( "\n{$style_tag_content}\n" );
1962+
echo $processor->get_updated_html();
19611963
}
19621964

19631965
/**

0 commit comments

Comments
 (0)