unregister_block_style( string $block_name, string $block_style_name ): bool

Unregisters a block style.


Block type name including namespace.
Block style name.


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


function unregister_block_style( $block_name, $block_style_name ) {
	return WP_Block_Styles_Registry::get_instance()->unregister( $block_name, $block_style_name );



User Contributed Notes

  1. Skip to note 3 content

    The following code sample unregister the style named ‘fancy-quote’ from the core quote block:

    unregister_block_style( 'core/quote', 'fancy-quote' );

    Important: The function unregister_block_style only unregisters styles that were registered on the server using register_block_style. The function does not unregister a style registered using client-side code.

  2. Skip to note 4 content

    As Marie Comet mentioned, you cannot use unregister_block_style() on a style that was registered serverside (e.g. via PHP). The following PHP will not unregister a block style from the core/table block:

    // PHP
    unregister_block_style( 'core/table', 'stripes' );

    You can use the Block API via JavaScript to unregister it. Running the following JavaScript will successfully unregister the style.

    // JavaScript
    wp.blocks.unregisterBlockStyle( 'core/table', 'stripes' );

    For more info, look under Styles in the Block API Reference of the Block Editor Handbook.

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