Make WordPress Core


Ignore:
Timestamp:
02/02/2023 06:50:54 PM (23 months ago)
Author:
flixos90
Message:

Editor: Add support for custom CSS in global styles.

This changeset introduces functions wp_get_global_styles_custom_css() and wp_enqueue_global_styles_custom_css(), which allow accessing and enqueuing custom CSS added via global styles.

Custom CSS via global styles is handled separately from custom CSS via the Customizer. If a site uses both features, the custom CSS from both sources will be loaded. The global styles custom CSS is then loaded after the Customizer custom CSS, so if there are any conflicts between the rules, the global styles take precedence.

Similarly to e.g. [55185], the result is cached in a non-persistent cache, except when WP_DEBUG is on to avoid interrupting the theme developer's workflow.

Props glendaviesnz, oandregal, ntsekouras, mamaduka, davidbaumwald, hellofromtonya, flixos90.
Fixes #57536.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-filters.php

    r55086 r55192  
    578578add_action( 'wp_footer', 'wp_enqueue_global_styles', 1 );
    579579
     580// Global styles custom CSS.
     581add_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles_custom_css' );
     582
    580583// Block supports, and other styles parsed and stored in the Style Engine.
    581584add_action( 'wp_enqueue_scripts', 'wp_enqueue_stored_styles' );
Note: See TracChangeset for help on using the changeset viewer.