Registers a block type. The recommended way is to register a block type using the metadata stored in the block.json file.
Parameters
$block_typestring|WP_Block_Type
Block type name including namespace, or alternatively a path to the JSON file with metadata definition for the block, or a path to the folder where the block.json file is located, or a complete WP_Block_Type instance. In case a WP_Block_Type is provided, the $args parameter will be ignored.
$argsarrayoptional
Array of block type arguments. Accepts any public property of WP_Block_Type. See WP_Block_Type::__construct() for information on accepted arguments. Default empty array.Default: array()
Return
WP_Block_Type|false
The registered block type on success, or false on failure.
register_legacy_post_comments_block()Ensures backwards compatibility for any users running the Gutenberg plugin who have used Post Comments before it was merged into Comments Query Loop.
Signature, return type and hooks compared across 5 parsed releases.
5.8.0
First parameter now accepts a path to the block.json file.from the docblock
5.0.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/blocks.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.