最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

admin - How To Remove ImportExport Option From Tools?

programmeradmin5浏览0评论

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 badges
Add a comment  | 

1 Answer 1

Reset to default 0

You 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' );
发布评论

评论列表(0)

  1. 暂无评论