Skip to content
Snippets Groups Projects
Commit f7cdc5ea authored by agata's avatar agata
Browse files

Revert "add ai-blocks.php"

This reverts commit 8e24c77d.
parent 8e24c77d
Branches
Tags v0.4.1
No related merge requests found
<?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
**/
add_action( 'setup_theme', 'ai_blocks_setup_theme_action' );
/**
* Function for `setup_theme` action-hook.
*
* @return void
*/
function ai_blocks_setup_theme_action(){
/*
* Blacklist specific Gutenberg blocks
*
* @author Misha Rudrastyh
* @link https://rudrastyh.com/gutenberg/remove-default-blocks.html#blacklist-blocks
*/
add_filter( 'allowed_block_types_all', 'blacklist_blocks' );
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 );
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment