I want to give admin access to a freelancer. One plugin named controlled admin access done most of the part for me, expect it don't have option to select or deselect subtools.
I want to give admin access to a freelancer. One plugin named controlled admin access done most of the part for me, expect it don't have option to select or deselect subtools.
Share Improve this question asked Apr 14, 2020 at 5:15 RGM7RGM7 133 bronze badges1 Answer
Reset to default 0You may use the hook admin_menu() and function remove_submenu_page()
The solution assumed the following conditions
- run it in theme functions.php, you may put somewhere else with different tweaking, but the following is proved to work in functions.php
- you know how to test the user access level by yourself, because the following solution is focus on removing the submenu only
function q364011_remove_tools_menu() {
// you may add your access rights checking logic here with conditions and then do the following
remove_submenu_page( 'tools.php', 'export.php' );
remove_submenu_page( 'tools.php', 'import.php' );
}
add_action( 'admin_menu', 'q364011_remove_tools_menu' );