File tree Expand file tree Collapse file tree 1 file changed +12
-11
lines changed
Expand file tree Collapse file tree 1 file changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -1967,17 +1967,18 @@ function _custom_background_cb() {
19671967 */
19681968function wp_custom_css_cb () {
19691969 $ styles = wp_get_custom_css ();
1970- if ( $ styles || is_customize_preview () ) :
1971- $ type_attr = current_theme_supports ( 'html5 ' , 'style ' ) ? '' : ' type="text/css" ' ;
1972- ?>
1973- <style<?php echo $ type_attr ; ?> id="wp-custom-css">
1974- <?php
1975- // Note that esc_html() cannot be used because `div > span` is not interpreted properly.
1976- echo strip_tags ( $ styles );
1977- ?>
1978- </style>
1979- <?php
1980- endif ;
1970+ if ( ! $ styles || ! is_customize_preview () ) {
1971+ return ;
1972+ }
1973+
1974+ $ processor = new WP_HTML_Tag_Processor ( '<style></style> ' );
1975+ $ processor ->next_tag ();
1976+ if ( ! current_theme_supports ( 'html5 ' , 'style ' ) ) {
1977+ $ processor ->set_attribute ( 'type ' , 'text/css ' );
1978+ }
1979+ $ processor ->set_attribute ( 'id ' , 'wp-custom-css ' );
1980+ $ processor ->set_modifiable_text ( $ styles );
1981+ echo $ processor ->get_updated_html ();
19811982}
19821983
19831984/**
You can’t perform that action at this time.
0 commit comments