Slightly misleading doc for should_load_separate_core_block_assets #1527
Labels
developer documentation (DevHub)
Improvements or additions to developer documentation
[Status] To do
Issue marked as Todo
Issue Description
When the filter should_load_separate_core_block_assets is set to true, core blocks only load their CSS when rendered which is totally fine and is expected. When this filter is set to true, the third party blocks also load their styles when rendered. When set to false, the assets for thirdparty blocks do not load at all if not rendered. The name of this filter is misleading users to believe that this only impacts core blocks. In reality, it somehow modifies thirdparty blocks' assets loading behavior as well.
The documentation is also missing for the block themes. The default value of this filter is false but it is actually true for the block themes. The classic themes are loading thirdparty blocks' assets on all pages whether rendered or not.
Also, you need to set priority to 11 in order for this to work after V6.4.
add_filter( 'should_load_separate_core_block_assets', '__return_false', 11 );
URL of the Page with the Issue
https://developer.wordpress.org/reference/hooks/should_load_separate_core_block_assets/
Section of Page with the issue
It's the description section which needs some modifications.
Why is this a problem?
There are many users' comment on the doc page leading me to believe this is a very common problem.
Suggested Fix
To address the confusion surrounding the should_load_separate_core_block_assets filter:
Clarify Filter Behavior: Update the documentation to explain that setting this filter to true not only defers core block CSS loading until rendering but also affects third-party block asset loading.
Document Block Theme Behavior: Note that while the default value is false, it's true for block themes, impacting asset loading.
Set Priority: After version 6.4, ensure the filter's priority is set to 11 for proper functionality.
The text was updated successfully, but these errors were encountered: