Aleš Sýkora / November 28, 2023 / 0 comments
Disable Gutenberg Blocks and Pattern library
2 min read / Custom Code, Gutenberg, Oxygen Builder, Plugins, WordPress / Share on: Twitter, LinkedIn, Facebook
Post summary: 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…
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/list-item',
'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.
Gutenberg Blocks and patterns before applying the code:
Blocks and Patterns after activating the code:
Fuel my passion for writing with a beer🍺
Your support not only makes me drunk but also greatly motivates me to continue creating content that helps. Cheers to more discoveries and shared success. 🍻