Author is Aleš Sýkora
Updated: 22. 9. 2022, Added: 22. 9. 2022
Disable Gutenberg Blocks and Pattern library
When I use Oxygen Builder to create website for customer, I want them to edit the content in Gutenberg editor, but I don't want to give them a "FULL POWER" of Gutenberg editor. What I do every time? Disable bunch of unused blocks and completely disable the patterns library. I also disable block styles and create my Own.
I use the code in Advanced Scripts plugin. It needs to run on INIT.
add_filter( 'allowed_block_types_all', 'great_tit_enable_blocks', 25, 2 );
function great_tit_enable_blocks( $allowed_blocks, $editor_context ) {
return array(
'core/paragraph',
'core/image',
'core/heading',
'core/gallery',
'core/list',
'core/quote',
'core/shortcode',
'core/audio',
'core/button',
'core/buttons',
'core/code',
'core/columns',
'core/column',
'core/code',
'core/columns',
'core/column',
'core/freeform',
'core/html',
'core/table',
'core/video'
);
}
/*Disable patterns*/
function disable_remote_patterns_filter() {
return false;
}
add_filter( 'should_load_remote_block_patterns', 'disable_remote_patterns_filter' );
remove_theme_support( 'core-block-patterns' );
Blocks list
For the more blocks visit official resource Blocks – WordPress.org Forums.