Site icon Hip-Hop Website Design and Development

Required (obligatory) Gutenberg block

Is there any option to power a Gutenberg block to be on each web page of a submit kind?

I attempted so as to add a template on my web page and it does nearly what I want, however I can nonetheless take away my default blocks.

The closest I’ve come is that this:

operate ckt_mina_init_required_block()
{
    // create a brand new web page template (pages solely)
    $page_type_object = get_post_type_object('web page');
    $page_type_object->template = [
        [
            'core/group',
            [],
            [
                // add a paragraph block for the page summary
                [
                    'core/paragraph',
                    [
                        'placeholder' => __('Excerpt'),
                    ],
                ],
                [
                    'core/image',
                    [],
                ],
            ],
        ],
    ];
    $page_type_object->template_lock = 'all';
}

add_action('init', 'ckt_mina_init_required_block');

This may create a brand new web page template and apply it to each new web page. The two blocks “paragraph” and “picture” can be current within the first group.

However I can’t add every other block to my web page.

Or, I can take away the template_lock = 'all', however then, my blocks will be eliminated in the course of the web page creation.

Any thought on how I would obtain to have 2 mounted blocks in the beginning of my Gutenberg space?