Make WordPress Core

Ticket #53505: 53505.2.diff

File 53505.2.diff, 2.2 KB (added by desrosj, 4 years ago)
  • src/wp-includes/script-loader.php

    diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
    index fa06871b7b..102f2b50e4 100644
    a b function wp_should_load_block_editor_scripts_and_styles() { 
    23262326}
    23272327
    23282328/**
    2329  * Checks whether separate assets should be loaded for core blocks on-render.
     2329 * Checks whether separate scripts and styles should be loaded for core blocks on-render.
    23302330 *
    23312331 * When this function returns true, other functions ensure that core blocks
    2332  * only load their styles on-render, and each block loads its own, individual
    2333  * stylesheet. Third-party blocks only load their styles when rendered.
     2332 * only load their assets on-render, and each block loads its own, individual
     2333 * assets. Third-party blocks only load their assets when rendered.
    23342334 *
    2335  * When this function returns false, all core block styles are loaded regardless
     2335 * When this function returns false, all core block assets are loaded regardless
    23362336 * of whether they are rendered in a page or not, because they are all part of
    2337  * the `block-library/style.css` file. Third-party blocks always get enqueued
    2338  * regardless of whether they are rendered or not.
     2337 * the `block-library/style.css` file. Assets for third-party blocks are always
     2338 * enqueued regardless of whether they are rendered or not.
    23392339 *
    23402340 * This only affects front end and not the block editor screens.
    23412341 *
    function wp_should_load_separate_core_block_assets() { 
    23522352        }
    23532353
    23542354        /**
    2355          * Filters the flag that decides whether separate scripts and styles
    2356          * will be loaded for core blocks on-render.
     2355         * Filters whether block scripts and styles should be loaded separately.
     2356         *
     2357         * Returning false loads all core block assets, regardless of whether they are rendered
     2358         * in a page or not. Returning true loads core block assets only when they are rendered.
    23572359         *
    23582360         * @since 5.8.0
    23592361         *
    23602362         * @param bool $load_separate_assets Whether separate assets will be loaded.
    2361          *                                   Default false.
     2363         *                                   Default false (all block assets are loaded, even when not used).
    23622364         */
    23632365        return apply_filters( 'should_load_separate_core_block_assets', false );
    23642366}