Changeset 61473 for trunk/src/wp-includes/script-loader.php
- Timestamp:
- 01/12/2026 12:18:12 PM (3 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/script-loader.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/script-loader.php
r61469 r61473 2515 2515 $stylesheet = wp_get_global_stylesheet(); 2516 2516 2517 if ( $is_block_theme ) { 2518 /* 2519 * Dequeue the Customizer's custom CSS 2520 * and add it before the global styles custom CSS. 2521 */ 2522 remove_action( 'wp_head', 'wp_custom_css_cb', 101 ); 2523 2524 /* 2525 * Get the custom CSS from the Customizer and add it to the global stylesheet. 2526 * Always do this in Customizer preview for the sake of live preview since it be empty. 2527 */ 2528 $custom_css = trim( wp_get_custom_css() ); 2529 if ( $custom_css || is_customize_preview() ) { 2530 if ( is_customize_preview() ) { 2531 /* 2532 * When in the Customizer preview, wrap the Custom CSS in milestone comments to allow customize-preview.js 2533 * to locate the CSS to replace for live previewing. Make sure that the milestone comments are omitted from 2534 * the stored Custom CSS if by chance someone tried to add them, which would be highly unlikely, but it 2535 * would break live previewing. 2536 */ 2537 $before_milestone = '/*BEGIN_CUSTOMIZER_CUSTOM_CSS*/'; 2538 $after_milestone = '/*END_CUSTOMIZER_CUSTOM_CSS*/'; 2539 $custom_css = str_replace( array( $before_milestone, $after_milestone ), '', $custom_css ); 2540 $custom_css = $before_milestone . "\n" . $custom_css . "\n" . $after_milestone; 2541 } 2542 $custom_css = "\n" . $custom_css; 2543 } 2544 $stylesheet .= $custom_css; 2545 2546 // Add the global styles custom CSS at the end. 2547 $stylesheet .= wp_get_global_stylesheet( array( 'custom-css' ) ); 2548 } 2517 /* 2518 * Dequeue the Customizer's custom CSS 2519 * and add it before the global styles custom CSS. 2520 */ 2521 remove_action( 'wp_head', 'wp_custom_css_cb', 101 ); 2522 2523 /* 2524 * Get the custom CSS from the Customizer and add it to the global stylesheet. 2525 * Always do this in Customizer preview for the sake of live preview since it be empty. 2526 */ 2527 $custom_css = trim( wp_get_custom_css() ); 2528 if ( $custom_css || is_customize_preview() ) { 2529 if ( is_customize_preview() ) { 2530 /* 2531 * When in the Customizer preview, wrap the Custom CSS in milestone comments to allow customize-preview.js 2532 * to locate the CSS to replace for live previewing. Make sure that the milestone comments are omitted from 2533 * the stored Custom CSS if by chance someone tried to add them, which would be highly unlikely, but it 2534 * would break live previewing. 2535 */ 2536 $before_milestone = '/*BEGIN_CUSTOMIZER_CUSTOM_CSS*/'; 2537 $after_milestone = '/*END_CUSTOMIZER_CUSTOM_CSS*/'; 2538 $custom_css = str_replace( array( $before_milestone, $after_milestone ), '', $custom_css ); 2539 $custom_css = $before_milestone . "\n" . $custom_css . "\n" . $after_milestone; 2540 } 2541 $custom_css = "\n" . $custom_css; 2542 } 2543 $stylesheet .= $custom_css; 2544 2545 // Add the global styles custom CSS at the end. 2546 $stylesheet .= wp_get_global_stylesheet( array( 'custom-css' ) ); 2549 2547 2550 2548 if ( empty( $stylesheet ) ) {
Note: See TracChangeset
for help on using the changeset viewer.