The Block Manager is an intuitive tool for site admins to globally remove blocks and block patterns. It also provides functionality for updating the category of individual blocks to help organize the admin editing experience.
functions.php
.Use Block Manager hooks to controls blocks via code and sync options across multiple WordPress environments.
Use the gbm_disabled_blocks
hook to remove blocks via backend code.
// functions.php
add_filter( 'gbm_disabled_blocks', function() {
return [
'core/buttons',
'core/columns',
'core/freeform',
'core/table'
];
});
Use the gbm_disabled_patterns
hook to remove block patterns via backend code.
// functions.php
add_filter( 'gbm_disabled_patterns', function() {
return ['gbm/core-patterns', 'core/query-standard-posts', 'core/query-medium-posts'];
});
Use the gbm_block_categories
hook to update block categories via backend code.
// functions.php
add_filter( 'gbm_block_categories', function() {
return [
[ 'block' => 'core/html', 'cat' => 'design' ],
[ 'block' => 'core/cover', 'cat' => 'design' ],
[ 'block' => 'core/details', 'cat' => 'design' ]
];
});
Update the minimum user role allowed to access the Block Manager plugin.
// functions.php
add_filter(
'block_manager_user_role',
'edit_theme_options' // Default: activate_plugins
);