Themes: Inline render blocking CSS `classic-themes.css'

Since [54358], a new CSS file classic-themes.css is enqueued on all pages on the front end of themes without `theme.json`. This is a blocking http request, the impact on performance will be affected by network conditions. Inlining this style, stops this blocking request. By adding style data of path to the registered style, the function `wp_maybe_inline_styles` will automatically inline the style for us. 

Props spacedmonkey, adamsilverstein.
Fixes #58480.
Built from https://develop.svn.wordpress.org/trunk@55930


git-svn-id: http://core.svn.wordpress.org/trunk@55442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
spacedmonkey 2023-06-16 13:28:21 +00:00
parent 985c726ff3
commit 8b93938860
2 changed files with 2 additions and 1 deletions

View File

@ -3718,6 +3718,7 @@ function wp_enqueue_classic_theme_styles() {
if ( ! wp_theme_has_theme_json() ) {
$suffix = wp_scripts_get_suffix();
wp_register_style( 'classic-theme-styles', '/' . WPINC . "/css/classic-themes$suffix.css" );
wp_style_add_data( 'classic-theme-styles', 'path', ABSPATH . WPINC . "/css/classic-themes$suffix.css" );
wp_enqueue_style( 'classic-theme-styles' );
}
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.3-alpha-55929';
$wp_version = '6.3-alpha-55930';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.