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.



git-svn-id: https://develop.svn.wordpress.org/trunk@50927 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Greg Ziółkowski
2021-05-19 13:50:09 +00:00
parent fe9ab38075
commit 6ad4e34c54
3 changed files with 53 additions and 33 deletions
+1 -1
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
);
}