Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slightly misleading doc for should_load_separate_core_block_assets #1527

Open
HasnainAshfaq opened this issue Apr 1, 2024 · 1 comment
Open
Labels
developer documentation (DevHub) Improvements or additions to developer documentation [Status] To do Issue marked as Todo

Comments

@HasnainAshfaq
Copy link

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.

@HasnainAshfaq HasnainAshfaq added the [Status] To do Issue marked as Todo label Apr 1, 2024
Copy link

github-actions bot commented Apr 1, 2024

Heads up @WordPress/docs-issues-coordinators, we have a new issue open. Time to use 'em labels.

@flexseth flexseth added the developer documentation (DevHub) Improvements or additions to developer documentation label Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer documentation (DevHub) Improvements or additions to developer documentation [Status] To do Issue marked as Todo
Projects
None yet
Development

No branches or pull requests

2 participants