register_block_type

Advertisement

Summery Summery

Registers a block type.

Syntax Syntax

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

Parameters Parameters

$name

(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

(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 Return

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

Source Source

File: wp-includes/blocks.php

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

Advertisement

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Advertisement

Leave a Reply