WP_Block_Type_Registry::is_registered( string $name ): bool

Checks if a block type is registered.

Parameters

$namestringrequired
Block type name including namespace.

Return

bool True if the block type is registered, false otherwise.

Source

public function is_registered( $name ) {
	return isset( $this->registered_block_types[ $name ] );
}

Changelog

VersionDescription
5.0.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    Used in a theme or plugin to check whether a particular block (core or custom) is registered:

    // $name would be written as a string like 'core/paragraph' or 'acf/my-block-name'
    function wpdocs_check_block_registry( $name ) { 
    	return WP_Block_Type_Registry::get_instance()->is_registered( $name );
    }

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