unregister_block_pattern( string $pattern_name ): bool

Unregisters a block pattern.


Parameters

$pattern_name string Required
Block pattern name including namespace.

Top ↑

Return

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


Top ↑

Source

File: wp-includes/class-wp-block-patterns-registry.php. View all references

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


Top ↑

Changelog

Changelog
Version Description
5.5.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Manish Songirkar

    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.