[wp-trac] [WordPress Trac] #64452: get_block_wrapper_attributes() function strips falsy values like zero

WordPress Trac noreply at wordpress.org
Thu Dec 25 10:17:26 UTC 2025


#64452: get_block_wrapper_attributes() function strips falsy values like zero
--------------------------+-----------------------------
 Reporter:  wildworks     |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 discovered while working on the Gutenberg project:
 https://github.com/WordPress/gutenberg/pull/74183#discussion_r2645807647

 A zero value is a valid value for the `id`, `class` and `aria-label`
 attributes, but because the empty function is used, the value is
 unintentionally removed.

 === Steps to reproduce

 - Crate a new post.
 - Insert an Archive block.
 - Open the Advanced panel and enter `0` as the Additional CSS Class.
 - This will appear in the code editor: `<!-- wp:archives {"className":"0"}
 /-->`
 - On the front end, open your browser developer tools and you'll see that
 the `class` attribute is missing from that block.

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


More information about the wp-trac mailing list