[wp-trac] [WordPress Trac] #63676: Blocks without rendered content still enqueue scripts and styles

WordPress Trac noreply at wordpress.org
Mon Jul 14 22:36:22 UTC 2025


#63676: Blocks without rendered content still enqueue scripts and styles
-------------------------------------+-------------------------------------
 Reporter:  westonruter              |       Owner:  westonruter
     Type:  defect (bug)             |      Status:  accepted
 Priority:  normal                   |   Milestone:  6.9
Component:  Editor                   |     Version:  5.9
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  javascript, css,
  needs-unit-tests dev-feedback      |  performance
-------------------------------------+-------------------------------------

Comment (by westonruter):

 Replying to [comment:8 dd32]:
 > I'm curious why you'd use the HTML tag parser here to detect output
 rather than a more basic `if ( $block_content ) { enqueue assets }`
 though.

 This is to handle a case where a plugin filters the block content to
 return an HTML comment as opposed to a falsy value, for example:

 {{{
 <!-- This block was removed because you do not have access! -->
 }}}

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


More information about the wp-trac mailing list