WP_Block_Styles_Registry::unregister() WordPress Method

The WP_Block_Styles_Registry::unregister() method is used to remove a registered block style from the WordPress block styles registry. This is typically used when a block style is no longer needed or when a plugin is being deactivated.

WP_Block_Styles_Registry::unregister( string $block_name, string $block_style_name ) #

Unregisters a block style of the given block type.


Parameters

$block_name

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

$block_style_name

(string)(Required)Block style name.


Top ↑

Return

(bool) True if the block style was unregistered with success and false otherwise.


Top ↑

Source

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

	public function unregister( $block_name, $block_style_name ) {
		if ( ! $this->is_registered( $block_name, $block_style_name ) ) {
			_doing_it_wrong(
				__METHOD__,
				/* translators: 1: Block name, 2: Block style name. */
				sprintf( __( 'Block "%1$s" does not contain a style named "%2$s".' ), $block_name, $block_style_name ),
				'5.3.0'
			);
			return false;
		}

		unset( $this->registered_block_styles[ $block_name ][ $block_style_name ] );

		return true;
	}


Top ↑

Changelog

Changelog
VersionDescription
5.3.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.