WP_Block_Type::__construct( string $block_type, array|string $args = array() )


Description Description

Will populate object properties from the provided arguments.

See also See also

Top ↑

Parameters Parameters


(string) (Required) Block type name including namespace.


(array|string) (Optional) Array or string of arguments for registering a block type. Any arguments may be defined, however the ones described below are supported by default.

  • 'title'
    (string) Human-readable block type label.
  • 'category'
    (string|null) Block type category classification, used in search interfaces to arrange block types by category.
  • 'parent'
    (array|null) Setting parent lets a block require that it is only available when nested within the specified blocks.
  • 'icon'
    (string|null) Block type icon.
  • 'description'
    (string) A detailed block type description.
  • 'keywords'
    (array) Additional keywords to produce block type as result in search interfaces.
  • 'textdomain'
    (string|null) The translation textdomain.
  • 'styles'
    (array) Alternative block styles.
  • 'supports'
    (array|null) Supported features.
  • 'example'
    (array|null) Structured data for the block preview.
  • 'render_callback'
    (callable|null) Block type render callback.
  • 'attributes'
    (array|null) Block type attributes property schemas.
  • 'uses_context'
    (array) Context values inherited by blocks of this type.
  • 'provides_context'
    (array|null) Context provided by blocks of this type.
  • 'editor_script'
    (string|null) Block type editor script handle.
  • 'script'
    (string|null) Block type front end script handle.
  • 'editor_style'
    (string|null) Block type editor style handle.
  • 'style'
    (string|null) Block type front end style handle.

Default value: array()

Top ↑

Source Source

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

	public function __construct( $block_type, $args = array() ) {
		$this->name = $block_type;

		$this->set_props( $args );

Top ↑

Changelog Changelog

Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.