From bf7850193614f1cd317e053a593f3b6034f6967b Mon Sep 17 00:00:00 2001 From: agata <agata@insiberia.net> Date: Fri, 2 Sep 2022 19:31:43 +0200 Subject: [PATCH] Revert "blocks allowed test" This reverts commit 4844bcbe76e85cbd59ac9422b22649c7c9655afe. --- ai-blocks.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/ai-blocks.php b/ai-blocks.php index 43f7b0b..8ebe708 100644 --- a/ai-blocks.php +++ b/ai-blocks.php @@ -8,17 +8,18 @@ * Author URI: https://autistici.org **/ -function wpdocs_allowed_block_types ( $block_editor_context, $editor_context ) { - if ( ! empty( $editor_context->post ) ) { - return array( - 'core/paragraph', - 'core/heading', - 'core/list', - ); - } - return $block_editor_context; +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', 'wpdocs_allowed_block_types', 10, 2 ); + +add_filter( 'allowed_block_types_all', 'blacklist_blocks' ); -- GitLab