WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/19/2021 01:50:09 PM (8 months ago)
Author:
gziolo
Message:

Editor: Extend register_block_type to accept the path file or folder with block.json

Rather than using two distinct methods to register block types in WordPress core, let's make register_block_type the canonical method to deal with all use cases. In practice, the patch proposed extends its usage to work as a proxy to register_block_type_from_metadata. It should remove some confusion that we observed and let us be more explicit what's the latest recommendation.

Props matveb, mcsf.
Fixes #53233.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/index.php

    r50824 r50927  
    6060
    6161    foreach ( $block_folders as $block_folder ) {
    62         register_block_type_from_metadata(
     62        register_block_type(
    6363            ABSPATH . WPINC . '/blocks/' . $block_folder
    6464        );
Note: See TracChangeset for help on using the changeset viewer.