GC_Block_Styles_Registry::unregister()

最后更新于:2021-11-26 10:47:34

GC_Block_Styles_Registry::unregister( string$block_name, string$block_style_name)

Unregisters a block style.

参数

$block_name

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

$block_style_name

(string) (Required) Block style name.

响应

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

源文件

文件: gc-includes/class-gc-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;
	}