25% off ProSNIPC25OFF

Register a Custom Block Category

Inserts a "My Custom Blocks" category at the top of the block inserter panel for grouping site-specific custom blocks.

PHPby SnipCraft
php
<?php
if ( ! function_exists( 'scseed_register_block_category' ) ) {
    function scseed_register_block_category( $categories, $editor_context ) {
        array_unshift(
            $categories,
            array(
                'slug'  => 'scseed-blocks',
                'title' => __( 'My Custom Blocks', 'scseed' ),
                'icon'  => 'screenoptions',
            )
        );
        return $categories;
    }
    add_filter( 'block_categories_all', 'scseed_register_block_category', 10, 2 );
}
#blocks#customization#editor#gutenberg