WordPress at a glance

register_block_type() WP 1.0

Registers a block type.

No Hooks.


WP_Block_Type|false. The registered block type on success, or false on failure.


register_block_type( $name, $args );
$name(string|WP_Block_Type) (required)
Block type name including namespace, or alternatively a complete WP_Block_Type instance. In case a WP_Block_Type is provided, the $args parameter will be ignored.
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


Since 5.0.0 Introduced.

Code of register_block_type() WP 5.7.2

function register_block_type( $name, $args = array() ) {
	return WP_Block_Type_Registry::get_instance()->register( $name, $args );
No comments
    Log In