Blokkeer bepaalde blokken (indien er bootstrap blokken zijn geïnstalleerd)
// activeer alleen als bootstrap blocks plugin actief is
if(in_array('block-editor-bootstrap-blocks/block-editor-bootstrap-blocks.php', apply_filters('active_plugins', get_option('active_plugins')))){
function wbmz_enqueue_block_restrictions() {
wp_enqueue_script(
'example-enqueue-block-variations',
get_template_directory_uri() . '/assets/js/restrict-blocks.js',
array( 'wp-blocks', 'wp-dom-ready' ),
wp_get_theme()->get( 'Version' ),
false
);
}
add_action( 'enqueue_block_editor_assets', 'wbmz_enqueue_block_restrictions' );
}
restrict-blocks.js aanmaken in /assets/js/
wp.domReady( () => {
wp.blocks.unregisterBlockType( 'core/media-text' );
wp.blocks.unregisterBlockType( 'core/columns' );
wp.blocks.unregisterBlockType( 'core/column' );
wp.blocks.unregisterBlockVariation( 'core/group', 'group-row' );
wp.blocks.unregisterBlockVariation( 'core/group', 'group-stack' );
} );
#blocks #custom #editor #functions #gutenberg