Map Block Plugin is not registering block correctly.
-
I like your plugin and have used it before, thanks for adding it for us to use. Unfortunately however, we have found a conflict this plugin has with a custom block plugin we have developed.
Our custom plugin registers a block that is specific to a
teams
custom post type, so we filter the specificmy-block/team-role
block out from theWP_Block_Type_Registry
when in another post type editor or non post context. It appears yourwebfactory/map
block is not registered in theWP_Block_Type_Registry
so is also being filtered out of the block editor.I fear that until your block is properly registered with
register_block_type()
, this function below will always remove it. I cannot find another way to filter out our custom block that does not also remove your block:public function custom_post_type_block_restrictions( $allowed_block_types, $block_editor_context ) { // hide '<span style="font-family: inherit; font-size: 0.8rem;">my-block/team-role' block from all post types except 'team-member'</span> if ( $block_editor_context->post === null || 'team-member' !== $block_editor_context->post->post_type ) { // Get all registered blocks. $all_blocks = array(); $registered_blocks = WP_Block_Type_Registry::get_instance()->get_all_registered(); foreach ( $registered_blocks as $registered_block ) { $all_blocks[] = $registered_block->name; } // Remove blocks. $disallowed_blocks = array( 'my-block/team-role', ); // Return allowed blocks. $allowed_block_types = array_values( array_diff( $all_blocks, $disallowed_blocks ) ); // $allowed_block_types = $all_blocks; // <-- this also removes map block as it is not in the registry! } return $allowed_block_types; }
- The topic ‘Map Block Plugin is not registering block correctly.’ is closed to new replies.