Removing Default Gutenberg Blocks, But Keeping Reusable Block Functionality?

The reusable block is registered with the core/block name.

I tried to add it to the allowed blocks in the allowed_block_types filter, here’s an example:

add_filter( 'allowed_block_types', 'wpse324908_allowed_block_types', 10, 2 );

function wpse324908_allowed_block_types( $allowed_blocks, $post ) {    
   $allowed_blocks = array(
        'core/block', // <-- Include to show reusable blocks in the block inserter.
        'core/image',
        'core/paragraph',
    );     
    return $allowed_blocks;    
}

and it showed the reusable blocks within the block inserter, if at least two other blocks were included as well:

Reusable

Looking at the /wp-includes/js/dist/editor.js we can e.g. see this check for core/block regarding including reusable blocks in the block inserter:

var selectors_canIncludeReusableBlockInInserter = function canIncludeReusableBlockInInserter(state, reusableBlock, rootClientId) {

  if (!selectors_canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId)) {
    return false;
  }

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)