There are a number of categories for Gutenberg blocks. Suppose you are developing your own blocks or you have a number of custom blocks. Now you need to keep them under a separate custom category. So, you need to create a custom category for your blocks.
<?php
function boilerplate_register_block_category( $categories, $post ) {
return array_merge(
array(
array(
'slug' => 'boilerplate',
'title' => __( 'Boilerplate', 'boilerplate' ),
),
),
$categories,
);
}
add_filter( 'block_categories_all','boilerplate_register_block_category', 10, 2 );
If you write the above codes, then go back to your page or post to work with the Gutenberg Block. Now you will find a custom category named My Custom Category.
Top comments (0)