WP_Block_Type_Registry::register

SummerySummery

Registers a block type.

Syntax

WP_Block_Type_Registry::register( string|WP_Block_Type $name, array $args = array() )

ParametersParameters

$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. 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.
  • 'attributes'
    (array) Block attributes mapping, property name to schema.

Default value: array()

ReturnReturn

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

SourceSource

File: wp-includes/class-wp-block-type-registry.php


			

ChangelogChangelog

Changelog
Version Description
5.0.0 Introduced.
Scroll to Top