Home Forums Gutenberg block templates – best practice? Reply To: block templates – best practice?

  • I don’t know if its possible to connect it to a certain page template , it would be great if it was possible. But at least its possible to set predefined blocks to a post or page or custom post type.

    Just add this function:

    function myplugin_register_template() {
        $post_type_object = get_post_type_object( 'page' );
        $post_type_object->template = array(
            array( 'acf/block1' ), // the name of your block
            array( 'acf/block2' ), // the name of your block
    add_action( 'init', 'myplugin_register_template' );