WP_Block_Type_Registry::is_registered( string $name ): bool

Checks if a block type is registered.


Parameters

$name string Required
Block type name including namespace.

Top ↑

Return

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


Top ↑

Source

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

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


Top ↑

Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Michelle

    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.