[wp-trac] [WordPress Trac] #53806: register_block_type_from_metadata does not allow full path to file as docs say it does

WordPress Trac noreply at wordpress.org
Tue Jul 27 23:39:40 UTC 2021


#53806: register_block_type_from_metadata does not allow full path to file as docs
say it does
--------------------------+-----------------------------
 Reporter:  coreyw        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Editor        |    Version:  5.8
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-----------------------------
 From the source code comment:

 > Path to the JSON file with metadata definition for the block or path to
 the folder where the `block.json` file is located.

 From [https://developer.wordpress.org/block-editor/reference-guides/block-
 api/block-metadata/ docs]:

 > `$block_type (string)` – path to the folder where the `block.json` file
 is located or full path to the metadata file if named differently.

 Both of these sound like you could do
 `register_block_type_from_metadata(__DIR__.'/custom-block.json', [])`. But
 this actually just ends up trying to test if `DIR/custom-
 block.json/block.json` exists.

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


More information about the wp-trac mailing list