WP_Block_Type_Registry::unregister() WordPress Method

The WP_Block_Type_Registry::unregister() method is used to unregister a block type from the block type registry. This is typically done when a plugin is deactivated or uninstalled.

WP_Block_Type_Registry::unregister( string|WP_Block_Type $name ) #

Unregisters a block type.


Parameters

$name

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


Top ↑

Return

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


Top ↑

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 ) ) {
			_doing_it_wrong(
				__METHOD__,
				/* translators: %s: Block name. */
				sprintf( __( 'Block type "%s" is not registered.' ), $name ),
				'5.0.0'
			);
			return false;
		}

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

		return $unregistered_block_type;
	}


Top ↑

Changelog

Changelog
VersionDescription
5.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.