WP_Block_Patterns_Registry::unregister()publicWP 5.5.0

Unregisters a block pattern.

{} It's a method of the class: WP_Block_Patterns_Registry{}

No Hooks.

Return

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

Usage

$WP_Block_Patterns_Registry = new WP_Block_Patterns_Registry();
$WP_Block_Patterns_Registry->unregister( $pattern_name );
$pattern_name(string) (required)
Block pattern name including namespace.

Changelog

Since 5.5.0 Introduced.

Code of WP_Block_Patterns_Registry::unregister() WP 6.0

public function unregister( $pattern_name ) {
	if ( ! $this->is_registered( $pattern_name ) ) {
		_doing_it_wrong(
			__METHOD__,
			/* translators: %s: Pattern name. */
			sprintf( __( 'Pattern "%s" not found.' ), $pattern_name ),
			'5.5.0'
		);
		return false;
	}

	unset( $this->registered_patterns[ $pattern_name ] );
	unset( $this->registered_patterns_outside_init[ $pattern_name ] );

	return true;
}