-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Styles for the .wp-container-uniqueID are loaded in the incorrect order or not loaded at all in 5.9.1 - 5.9.2 #39207
Comments
WordPress 5.9.0 without Gutenberg: Styles are included WordPress 5.9.1 without Gutenberg: Styles are not included |
Pinging @oandregal. This might be related to #38750 which was backported into minor release. |
Another issue reported #39217. |
@oandregal @youknowriad Hi, do you think this is something we can locate and fix before 6.0? 🙏 |
Is this related to this one? #39164 Is it because these themes are missing |
If I add a PHP template to a block theme and then use do_blocks(), I also use wp_head(). I believe it would be an earlier change since it works in 5.9.0 but not 5.9.1. |
I think it's related to this #38750 (which is the first step of #39164 ). The problem is that it used to work in 5.9 but just "by luck" basically, because I think reverting is not the right solution though because the bug fixed by those PRs could be seen as even more important. Maybe the right approach here is to offer a function that returns both template and styles somehow wrapping |
Is the comment about the loading order related or should I move it to a separate issue after all? |
I think that comment is what was solved by #39164 if I'm not wrong. (and it's marked for backport to next minor if there's any) Edit: corrected the link |
This commit gMagicScott/core.wordpress-mirror@f481d34 seems indeed to fix it. |
Using do_blocks() still does not print the .wp-container-uniqueID CSS for the blocks. |
A workaround to get the block support styles printed in the
|
I think the best solution would be to have a function that returns the output of blocks (style, JS and HTML) without relying on hooks. ( Basically we need the APIs to render blocks to avoid relying on this hooks to be flexible enough. Right now rendering blocks has strong assumptions about the themes as a context. In other words This probably deserves its own issue I think. |
Any news about that? I'm trying to use virtual page template within block theme and render header and footer within Layout styles not loaded and inline blocks styles rendered before body so there is a specificity problem within custom styles which overrides blocks styles within standard block theme. Thanks |
The new issue is here: |
Yes, solution from @bradfrumos working. Thanks |
The inline styling for blocks is also missing when you get content with an AJAX request. I've been trying to figure out a solution to this for hours with no luck. I can't for the life of me find where the unique block styles/classes like .wp-container-uniqueID are coming from. |
Hi @Bijingus If I'm understanding things correctly, this is a known issue. @andrewserong spent some time trying to work out a fix too. I think these PRs are related:
A lot of them are being applied by the layout implementation in layout.php, but the REST API does not include them. |
Description
Since Gutenberg 12.7, if you use do_blocks() to render a block, the CSS normally placed in a style tag for the
wp-container-uniqueID
inline in the document is missing. Such as the flex, margins, widths and alignments.I have received multiple reports and support requests about this causing problems with missing styles for universal and hybrid themes.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
WordPress 5.9.1
Gutenberg 12.7.
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: