[wp-trac] [WordPress Trac] #54956: [5.9] wp_block_type args - "style" and "script" are always loaded on Frontend

WordPress Trac noreply at wordpress.org
Thu Jan 27 17:15:29 UTC 2022


#54956: [5.9] wp_block_type args - "style" and "script" are always loaded on
Frontend
--------------------------+-----------------------------
 Reporter:  pkostadinov   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  5.9
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Before 5.9 - `style` and `script` are loaded when the block is added to
 specific page.
 After 5.9 - `style` and `script` are always loaded, on all pages, all the
 time, everywhere, regardless if the block is displayed on specific page or
 not.

 More info about my use case:
 - `style` and `script` both reference a registered script/style, which
 have multiple dependencies (`wp_register_style` has `$deps` array defined
 that references more registered styles)

 Temporary fix I did to the client code:
 - Replacing `style` and `script` with `styles` and `view_script` fixed the
 issue

 However this "fix" requires specific WP Core version - 5.8.3 should use
 `style` and `script`, while 5.9 should use `styles` and `view_script`.

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


More information about the wp-trac mailing list