One of the great features of the Gutenberg editor, is the ability to create a reusable block. Reusable blocks are very powerful in that they allow you to create a block that can be used in multiple places and look and behave the same way no matter where that block is used. Plus, when you edit a reusable block, the changes are applied everywhere that it is used.

If you are using Advanced Custom Fields, you can convert any block you register into a reusable block.

As Bill Erickson described in Using Block Templates with Gutenberg, block templates allow us the have particular blocks automatically added to the editor.

Block templates can be added to a custom post when the post is registered.

'template' => array(
     array( 'core/cover', array(
        'dimRatio' => 0,
        'className' => 'banner',
      ) ),
      array( 'acf/properties', array(
        'placeholder' => 'Add Property...',
      ) ),
      array( 'core/block', array(
          'ref' => '4813',
      ) ),
     array( 'core/quote', array(
         'placeholder' => 'Add Testimonial...',
          'className' => 'is-style-large testimonial-footer',
      ) ), 

In the above code that we are using several different blocks and setting properties for each of them. Of particular interest is the core/block with the “ref” number.

The core/block is our reusable block and the number is the post id. Reusable blocks are a custom post type “wp_block”, which like other post types has a unique id. So, how do you find the correct id?

In the editor, bring up the block select and open the Reusable Category. Click on the “Manage All Reusable Blocks” link.

Manage Reusable Blocks

Next you will see a screen that lists all of your reusable blocks. Mouse over the title to see the id. That is the id you will use in your template.

Getting the Reusable Block ID

If you are restricting your block to a custom post type as discussed in the previous post, How to Build a Gutenberg Block with Advanced Custom Fields and Custom Posts Types, you must also include wp_block as one of the allowed post types in order to be able to edit the reusable block.

// register a sold gallery  block
	'name'				=> 'property-galleries',
	'title'				=> __('Property Galleries'),
	'description'		=> __('GBK Properties Gallery  Block.'),
	'render_callback' => array($this, 'gbk_acf_block_render_callback'),
	'category'			=> 'layout',
	'icon'				=> 'images-alt',
	'align' => false,
	'post_types' => array( 'gbk_properties', 'wp_block' ),
	'mode' => 'edit',
	'keywords'			=> array( 'properties', 'broker' ),