From 7f804f843696a20a5a753ab296e28cd312743b92 Mon Sep 17 00:00:00 2001 From: gziolo Date: Tue, 11 May 2021 14:16:01 +0000 Subject: [PATCH] Editor: Fix regression introduced with loading separate block assets Related to [50836]. load-styles.php doesn't load the should_load_separate_core_block_assets function and that causes an error 500 - which in turn makes the dashboard appear unstyled. Props aristath. Fixes #53180. Built from https://develop.svn.wordpress.org/trunk@50837 git-svn-id: http://core.svn.wordpress.org/trunk@50446 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/blocks.php | 23 ----------------------- wp-includes/script-loader.php | 28 +++++++++++++++++++++++++--- wp-includes/version.php | 2 +- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index 2d33580b0e..9a552835f7 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -952,26 +952,3 @@ function block_has_support( $block_type, $feature, $default = false ) { return true === $block_support || is_array( $block_support ); } - -/** - * Checks whether separate assets should be loaded for core blocks. - * - * @since 5.8 - * - * @return bool - */ -function should_load_separate_core_block_assets() { - if ( is_admin() || is_feed() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) { - return false; - } - /** - * Determine if separate styles & scripts will be loaded for blocks on-render or not. - * - * @since 5.8.0 - * - * @param bool $load_separate_styles Whether separate styles will be loaded or not. - * - * @return bool Whether separate styles will be loaded or not. - */ - return apply_filters( 'separate_core_block_assets', false ); -} diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 704c59e652..6558159020 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -1364,6 +1364,29 @@ function wp_default_scripts( $scripts ) { } } +/** + * Checks whether separate assets should be loaded for core blocks. + * + * @since 5.8 + * + * @return bool + */ +function should_load_separate_core_block_assets() { + if ( is_admin() || is_feed() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) { + return false; + } + /** + * Determine if separate styles & scripts will be loaded for blocks on-render or not. + * + * @since 5.8.0 + * + * @param bool $load_separate_styles Whether separate styles will be loaded or not. + * + * @return bool Whether separate styles will be loaded or not. + */ + return apply_filters( 'separate_core_block_assets', false ); +} + /** * Assign default styles to $styles object. * @@ -1501,9 +1524,8 @@ function wp_default_styles( $styles ) { $fonts_url = 'https://fonts.googleapis.com/css?family=' . urlencode( $font_family ); } $styles->add( 'wp-editor-font', $fonts_url ); // No longer used in core as of 5.7. - - $block_library_theme_path = "/wp-includes/css/dist/block-library/theme$suffix.css"; - $styles->add( 'wp-block-library-theme', $block_library_theme_path ); + $block_library_theme_path = WPINC . "/css/dist/block-library/theme$suffix.css"; + $styles->add( 'wp-block-library-theme', "/$block_library_theme_path" ); $styles->add_data( 'wp-block-library-theme', 'path', ABSPATH . $block_library_theme_path ); $styles->add( diff --git a/wp-includes/version.php b/wp-includes/version.php index 21230131b1..9a51b8cf7a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.8-alpha-50836'; +$wp_version = '5.8-alpha-50837'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.