• Resolved twobyte

    (@twobyte)


    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 specific my-block/team-role block out from the WP_Block_Type_Registry when in another post type editor or non post context. It appears your webfactory/map block is not registered in the WP_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;
    } 
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter twobyte

    (@twobyte)

    As a stop gap, to get your plugin to work, I have added this line:

    $allowed_block_types[] = "webfactory/map";
    Thread Starter twobyte

    (@twobyte)

    Just discovered this plugin is also breaking the new block widget editor. Maybe registering the block with register_block_type() will fix that too!

    Plugin Author Alexandru Tapuleasa

    (@talextech)

    Thanks for letting us know! We will look into it as soon as we can 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.