-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Only split block styles loading for block themes #31309
Conversation
Size Change: -297 B (0%) Total Size: 1.31 MB
ℹ️ View Unchanged
|
By looking at #31293 it seems the issue is that the block styles are rendered in different places. Can we make it so they are always rendered in the same place (in the header)? I'm not sure where things such as I presume these come from core. My concern with enqueuing core styles in the footer (both these block styles + global styles) is that it's more difficult for 3rd parties to override them (themes, plugins, etc) should they need it. |
Pushed an alternative fix that makes more sense for non-FSE themes 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested that this fixes the issue described in #31293 — block styles for non-FSE themes are loaded in the header + in the correct order (before global styles).
+1 to this, I was confused why sometimes those inline styles would be loaded in the footer vs always the header, and could not figure out where they were coming from. |
* Load global styles in the footer if theme is not a block theme * We don't really need the current_theme_supports check here 🤔 * The better fix
Description
If the theme is using
theme.json
- so has global styles enabled, but is NOT a block theme, global styles get overridden by other styles.See #31293 for a detailed description of the issue.
This PR fixes the issue by making sure that separate styles are only used in FSE themes - or when the theme opts in.
How has this been tested?
Followed the instructions in #31293 and confirmed this fixes the issue.
Checklist:
*.native.js
files for terms that need renaming or removal).