W3cubDocs

/WordPress

register_block_type( string|WP_Block_Type $name, array $args = array() )

Registers a block type.

Parameters

$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.

$args

(array) (Optional) Array of block type arguments. Accepts any public property of WP_Block_Type. Any arguments may be defined, however the ones described below are supported by default.

  • 'render_callback'
    (callable) Callback used to render blocks of this block type.

Default value: array()

Return

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

Source

File: wp-includes/blocks.php

function register_block_type( $name, $args = array() ) {
	return WP_Block_Type_Registry::get_instance()->register( $name, $args );
}

Changelog

Version Description
5.0.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/register_block_type