Make WordPress Core


Ignore:
Timestamp:
05/11/2021 02:14:15 PM (5 years ago)
Author:
gziolo
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r50836 r50837  
    13661366
    13671367/**
     1368 * Checks whether separate assets should be loaded for core blocks.
     1369 *
     1370 * @since 5.8
     1371 *
     1372 * @return bool
     1373 */
     1374function should_load_separate_core_block_assets() {
     1375        if ( is_admin() || is_feed() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) {
     1376                return false;
     1377        }
     1378        /**
     1379         * Determine if separate styles & scripts will be loaded for blocks on-render or not.
     1380         *
     1381         * @since 5.8.0
     1382         *
     1383         * @param bool $load_separate_styles Whether separate styles will be loaded or not.
     1384         *
     1385         * @return bool Whether separate styles will be loaded or not.
     1386         */
     1387        return apply_filters( 'separate_core_block_assets', false );
     1388}
     1389
     1390/**
    13681391 * Assign default styles to $styles object.
    13691392 *
    … …  
    15021525        }
    15031526        $styles->add( 'wp-editor-font', $fonts_url ); // No longer used in core as of 5.7.
    1504 
    1505         $block_library_theme_path = "/wp-includes/css/dist/block-library/theme$suffix.css";
    1506         $styles->add( 'wp-block-library-theme', $block_library_theme_path );
     1527        $block_library_theme_path = WPINC . "/css/dist/block-library/theme$suffix.css";
     1528        $styles->add( 'wp-block-library-theme', "/$block_library_theme_path" );
    15071529        $styles->add_data( 'wp-block-library-theme', 'path', ABSPATH . $block_library_theme_path );
    15081530
Note: See TracChangeset for help on using the changeset viewer.