Found a JavaScript solution. If I remember correctly there was some talk about temporary solution this or related Github issues so keep that in mind. But I guess this means only server side so for only UI hiding I guess this will be fine.
const wp = window.wp; // when using webpack
wp.data.dispatch( 'core/edit-post' ).hideBlockTypes( [
'core-embed/youtube',
'core-embed/vimeo',
'core-embed/dailymotion',
'core-embed/collegehumor',
'core-embed/ted',
] );
Also found some wrong PHP code that I fixed but its still not working correctly as the array does not contain all blocks.
add_filter( 'allowed_block_types', __NAMESPACE__ . '\remove_core_video_blocks' );
function remove_core_video_blocks( $allowed_blocks ) {
$guten_blocks = \WP_Block_Type_Registry::get_instance()->get_all_registered();
foreach ( $guten_blocks as $key => $value) {
$registered_blocks[] = $key;
}
$allowed_blocks = array_diff(
$registered_blocks, // NOTE registered blocks does NOT contains all blocks
array( 'wp-embed/youtube' )
);
return $allowed_blocks;
}