[wp-trac] [WordPress Trac] #53494: Styles not applied to block using theme.json with seperate assets loading enabled

WordPress Trac noreply at wordpress.org
Tue Jun 29 19:32:44 UTC 2021


#53494: Styles not applied to block using theme.json with seperate assets loading
enabled
--------------------------+-----------------------
 Reporter:  walbo         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  5.8
Component:  Editor        |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+-----------------------

Comment (by desrosj):

 I was just talking this through with @Clorith a bit in Slack after he was
 kind enough to run my new PR through some testing.

 The PR currently assumes that `wp_enqueue_global_styles()` is run on both
 `wp_footer` and `wp_head`, but that's not the case. I've pushed an update
 to also hook the function to `wp_footer` so that PR should now fix the
 issue.

 One potential side effect here is that a style handle must be registered
 before inline styles or other data can be added to that style. If we
 return early when the styles are desired in the footer, the script will
 not be registered, and any other code calling `wp_add_inline_style()`
 before `wp_footer` will silently fail.

 I'm thinking that no matter what, the style should at least be registered
 within the `wp_enqueue_scripts` hook, and only enqueued on once based on
 the result of `wp_should_load_separate_core_block_assets()`.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53494#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list