Registers a block type. The recommended way is to register a block type using the metadata stored in the block.json file.
$block_typestring|WP_Block_Typerequired
block.json file is located, or a complete WP_Block_Type instance.$argsarrayoptional
WP_Block_Type. See WP_Block_Type::__construct() for information on accepted arguments. Default:array()
function register_block_type( $block_type, $args = array() ) {
if ( is_string( $block_type ) && file_exists( $block_type ) ) {
return register_block_type_from_metadata( $block_type, $args );
}
return WP_Block_Type_Registry::get_instance()->register( $block_type, $args );
}
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/register_block_type