From 9c6d72647a8bca47df5c80405a704e82e81a3603 Mon Sep 17 00:00:00 2001
From: agata <agata@insiberia.net>
Date: Fri, 2 Sep 2022 17:30:00 +0200
Subject: [PATCH] manage blocks

---
 ai-blocks.php | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 ai-blocks.php

diff --git a/ai-blocks.php b/ai-blocks.php
new file mode 100644
index 0000000..8ebe708
--- /dev/null
+++ b/ai-blocks.php
@@ -0,0 +1,25 @@
+<?php
+/*
+* Plugin Name: A/I - Add a denylist of gutenberg blocks
+* Plugin URI:
+* Description: Remove some block from editor
+* Version: 0.0.1
+* Author: Autistici/Inventati
+* Author URI: https://autistici.org
+**/
+
+ 
+function blacklist_blocks( $allowed_blocks ) {
+	// get all the registered blocks
+	$blocks = WP_Block_Type_Registry::get_instance()->get_all_registered();
+
+	// then disable some of them
+	unset( $blocks[ 'core/embed' ] );
+
+	// return the new list of allowed blocks
+	return array_keys( $blocks );
+	
+}
+
+add_filter( 'allowed_block_types_all', 'blacklist_blocks' );
+
-- 
GitLab