WordPress.org

Make WordPress Core

Changeset 51263


Ignore:
Timestamp:
06/29/2021 06:44:45 PM (3 months ago)
Author:
jorbin
Message:

Docs: Further Improve documentation for wp_should_load_separate_core_block_assets().

In [51256], the documentation was improved, this further improves it. As scripts are not yet a part of what this function does, they are not mentioned explicitly. Assets is used so that the docs don't need a lot of improvements when scripts do come into play..

Props desrosj, SergeyBiryukov, Jorbin.
See #53505.

File:
1 edited

Legend:

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

    r51256 r51263  
    23272327
    23282328/**
    2329  * Checks whether separate assets should be loaded for core blocks on-render.
     2329 * Checks whether separate 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.
    2334  *
    2335  * When this function returns false, all core block styles are loaded regardless
     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.
     2334 *
     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.
     
    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 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 );
Note: See TracChangeset for help on using the changeset viewer.