unregister_block_pattern( string $pattern_name ): bool

Unregisters a block pattern.

Parameters

$pattern_namestringrequired
Block pattern name including namespace.

Return

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

Source

function unregister_block_pattern( $pattern_name ) {
	return WP_Block_Patterns_Registry::get_instance()->unregister( $pattern_name );
}

Changelog

VersionDescription
5.5.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    Example code to remove pattern,

    unregister_block_pattern( 'wpdocs-plugin/wpdocs-columns-list' );

    Example code to remove specific patterns registered in core,

    add_action( 'init', 'wpdocs_remove_core_patterns' );
    
    function wpdocs_remove_core_patterns() {
    	$core_block_patterns = array(
    		'query-standard-posts',
    		'query-medium-posts',
    		'query-small-posts',
    		'query-grid-posts',
    		'query-large-title-posts',
    		'query-offset-posts',
    		'social-links-shared-background-color',
    	);
    
    	foreach ( $core_block_patterns as $core_block_pattern ) {
    		unregister_block_pattern( 'core/' . $core_block_pattern );
    	}
    }

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