[wp-trac] [WordPress Trac] #57797: WP_Block_Type_Registry::register issues incorrect error message when block.json folder doesn't exist

WordPress Trac noreply at wordpress.org
Thu Feb 23 20:25:56 UTC 2023


#57797: WP_Block_Type_Registry::register issues incorrect error message when
block.json folder doesn't exist
--------------------------+------------------------------
 Reporter:  Tonygirling   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  6.1.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by antonvlasenko):

 > I see ->register is still called even though the call to file_exists()
 fails

 I agree. It is a bit misleading. `register_block_type()` must not try to
 assume what `$block_type` is (a path to a file or a block type name) and
 should fail with an error if the file doesn't exist.
 Is it possible to change this behaviour?
 Yes, of course, but, unfortunately, that would break backward
 compatibility.

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


More information about the wp-trac mailing list