wpseek.com
A WordPress-centric search engine for devs and theme authors
register_block_type › WordPress Function
Since5.0.0
Deprecatedn/a
› register_block_type ( $block_type, $args = array() )
| Parameters: (2) |
|
| Returns: |
|
| Defined at: |
|
| Codex: | |
| Change Log: |
|
Registers a block type. The recommended way is to register a block type using the metadata stored in the `block.json` file.
Related Functions: unregister_block_type, register_block_style, unregister_block_style, register_block_pattern, register_block_template
Source
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 );
}
/** @var (lowercase-string&non-falsy-string)|WP_Block_Type $block_type A string that is not a path to block metadata should be a block type name. */
return WP_Block_Type_Registry::get_instance()->register( $block_type, $args );
}