admin管理员组

文章数量:1126298

I'm building a wp blocks theme for in-house websites with controlled branding. This theme will be rolled out to hundreds of websites.

I want to create a second level administrator role and remove capabilities like install_plugins, install_themes, delete_themes, delete_plugins, edit_plugins, edit_themes. But this role needs all management of content and users.

How can I give this role the capability to edit the Site Editor - Navigation? And not allow the role to edit anything else in the theme, no editing header/footer, page templates or patterns.

I only want to do this in the functions.php to avoid having hundreds of websites with additional plugins for managing a simple lock down feature.

Example code:

add_role( 'test2', 'test2', get_role( 'administrator' )->capabilities );

$role = get_role( 'test2');
$role->remove_cap('edit_theme_options'); 
add_action( 'admin_init', 'my_theme_caps');

/????what is the method to make it enable nav_menus ????/

Thank you for your advice

本文标签: navigationAddremove capability for blocks theme nav menu