In Full Site Editing (FSE) in WordPress, the permissions model is a bit different compared to the Classic Editor. By default, Editors typically have access to the Site Editor, which allows them to make significant changes to the site’s design and layout, including the menu.
However, if you’re concerned about giving Editors too much control, here are a few options to consider (custom functions you can add to your functions.php):
A. You can create custom roles
/**
* Add custom roles
* @author Archie M
*
*/
function add_custom_editor_role() {
// Remove default role
remove_role('editor');
// Add new custom role with preferred limited capabilities
add_role('custom_editor', 'Custom Editor', [
'read' => true,
'edit_posts' => true,
'edit_published_posts' => true,
'delete_posts' => false,
'delete_published_posts' => false,
'edit_theme_options' => false, // Prevent access to Site Editor
// Add more capabilities as needed
]);
}
add_action('init', 'add_custom_editor_role');
B. Disable certain blocks by user roles
/**
* Disable certain blocks by user roles
* @author Archie M
*
*/
function disable_blocks_for_custom_role() {
if (current_user_can('custom_editor') && $post->post_type === 'post') {
// List of blocks to disable
$blocked_blocks = [
'core/heading',
'core/image',
'core/paragraph',
// Add more blocks as needed
];
return array_diff($allowed_block_types, $blocked_blocks);
}
return $allowed_block_types;
}
add_filter('allowed_block_types', 'disable_blocks_for_custom_role', 10, 2);
B. For menus??
There are some plugins on www.ads-software.com that you can use to manipulate this and hide or show menuas to specific users based on roles, etc.
I hope the above is helpful and good luck!