apply_filters( ‘should_load_separate_core_block_assets’, bool $load_separate_assets )

Filters whether block styles should be loaded separately.


Returning false loads all core block assets, regardless of whether they are rendered in a page or not. Returning true loads core block assets only when they are rendered.


Whether separate assets will be loaded.
Default false (all block assets are loaded, even when not used).


return apply_filters( 'should_load_separate_core_block_assets', false );



User Contributed Notes

  1. Skip to note 6 content

    Since v6.4 you need to add a priority of 11 for this filter to work if you are trying to force block themes to load all block styles rather than just those which WordPress detects are being used …

    add_filter( 'should_load_separate_core_block_assets', '__return_false', 11 );
  2. Skip to note 7 content

    This hook is poorly named: when returning `true` with this hook; many 3rd-party blocks’ assets (JS and CSS) will only load when those blocks are being used on a page; slightly speeding up your website.

    To use:
    add_filter( 'should_load_separate_core_block_assets', '__return_true' ); it only needs to be added once for each instance of WordPress you are working with; you do not need to add for each block or plugin that you wish to conditionally load.

You must log in before being able to contribute a note or feedback.