[wp-trac] [WordPress Trac] #55184: Custom style handle attached to a custom block style is never load even if the block is in the page.

WordPress Trac noreply at wordpress.org
Thu Feb 17 11:12:39 UTC 2022


#55184: Custom style handle attached to a custom block style is never load even if
the block is in the page.
-----------------------------+-----------------------------
 Reporter:  alexandrebuffet  |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Script Loader    |    Version:  5.9
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 == Description

 I have a custom block based theme running on WP 5.9 that declares custom
 styles for certain blocks via the register_block_style function, but when
 I specify a style_handle the style is never enqueue even though the block
 is present in the page content (and core block assets are only loaded when
 they are rendered).

 This issue ref to ticket #54457
 https://core.trac.wordpress.org/ticket/54457

 == Step-by-step reproduction instructions

 1. Create a theme
 2. Register a custom "Display" block style for the "Heading" block via
 register_block_style with "my-theme-block-style-css" style_handle
 3. Register a "my-theme-block-style-css" style via wp_register_style
 4. Add "Heading" block in page content with our "Display" style
 5. Check CSS, "my-theme-block-style-css" is not loaded

 == The relevant code

 It seems that the render_block filter callback in
 enqueue_block_styles_assets from script-loader.php never fire.

 script-loader.php
 [https://github.com/WordPress/wordpress-develop/blob/master/src/wp-
 includes/script-loader.php#L2463-L2477]

 [https://core.trac.wordpress.org/changeset/52262]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55184>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list