WP_Block_Type_Registry::unregister

Advertisement

Summery Summery

Unregisters a block type.

Syntax Syntax

WP_Block_Type_Registry::unregister( string|WP_Block_Type $name )

Parameters Parameters

$name

(Required) Block type name including namespace, or alternatively a complete WP_Block_Type instance.

Return Return

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

Source Source

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

	 */
	public function unregister( $name ) {
		if ( $name instanceof WP_Block_Type ) {
			$name = $name->name;
		}

		if ( ! $this->is_registered( $name ) ) {
			/* translators: %s: Block name. */
			$message = sprintf( __( 'Block type "%s" is not registered.' ), $name );
			_doing_it_wrong( __METHOD__, $message, '5.0.0' );
			return false;
		}

		$unregistered_block_type = $this->registered_block_types[ $name ];
		unset( $this->registered_block_types[ $name ] );

		return $unregistered_block_type;

Advertisement

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Advertisement

Leave a Reply