Add your own category to the block inserter, ready to hold the custom blocks you build for a site.
add_filter( 'block_categories_all', function ( array $categories ): array {
return array_merge(
[
[
'slug' => 'nahnu-blocks',
'title' => 'Site blocks',
'icon' => null,
],
],
$categories
);
} );
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
Custom blocks get lost among the core categories. Putting them in their own category, at the top of the inserter, makes them easy to find.
The block_categories_all filter returns the inserter’s categories in order. The snippet adds one at the start. Blocks join it by setting "category": "nahnu-blocks" in their block.json.
register_block_pattern_category() instead.Register a block with the new category and open the inserter. “Site blocks” should appear first.