Gutenberg allow use of block, but hide it from the block picker

Question

I am using a block for a page template like so:

function register_work_template() {
    $post_type_object = get_post_type_object( 'work' );
    $post_type_object->template = array(
        array( 'djave/worktemplate', array(
            'placeholder' => 'Add Description...',
        ) ),
    );
    $post_type_object->template_lock = 'all';
}
add_action( 'init', 'register_work_template' );

I know how to register or unregister the djave/worktemplate block, but how can I allow its use in this page template, but hide it from the block picker so it can’t be used in again in other InnerBlocks or pages?

0
Djave 4 months 2022-03-27T06:21:50-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse