diff --git a/composer.patches.json b/composer.patches.json index a30bc67eac72893d3a7f2fa9b4c0687e63df16de..3aaa22d84e5172db64c3aa1b1c7b823aae447c16 100644 --- a/composer.patches.json +++ b/composer.patches.json @@ -4,7 +4,8 @@ "Anonymize requests to api.wordpress.org for updates": "patches/core/anonymize-update.php.patch", "Do not perform pingbacks and trackbacks when we update via cron": "patches/core/0103-Remove-pingback-trackback.patch", "Load JS library locally instead than from Googleapis": "patches/core/0155-Removing-reference-to-googleapis-from-wp-includes-up.patch", - "Remove Google Fonts API calls": "patches/core/0165-remove-google-fonts.patch" + "Remove Google Fonts API calls": "patches/core/0165-remove-google-fonts.patch", + "Manage Blocks":"patches/core/ai-blocks.patch" }, "wpackagist-plugin/disable-wordpress-updates": { "Run update checks during cron": "patches/plugins/disable-wordpress-updates.patch" diff --git a/patches/core/ai-blocks.patch b/patches/core/ai-blocks.patch new file mode 100644 index 0000000000000000000000000000000000000000..8ebe70833dbdb49611d4ad06091db9f5063fa139 --- /dev/null +++ b/patches/core/ai-blocks.patch @@ -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' ); +