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.


Built from https://develop.svn.wordpress.org/trunk@50927


git-svn-id: http://core.svn.wordpress.org/trunk@50536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
gziolo
2021-05-19 13:52:00 +00:00
parent 2b6cc00455
commit 2ca2feff15
3 changed files with 42 additions and 34 deletions

View File

@@ -59,7 +59,7 @@ function register_core_block_types_from_metadata() {
);
foreach ( $block_folders as $block_folder ) {
register_block_type_from_metadata(
register_block_type(
ABSPATH . WPINC . '/blocks/' . $block_folder
);
}