织梦CMS - 轻松建站从此开始!

欧博ABG-会员注册-官网网址

欧博abgWordPress Development Stack Exchange

时间:2025-08-05 20:43来源: 作者:admin 点击: 1 次
Try this: add_action('_admin_menu', 'remove_editor_submenu', 1); function remove_editor_submenu() { remove_action('admin_menu', '_add_themes_utility

Try this:

add_action('_admin_menu', 'remove_editor_submenu', 1); function remove_editor_submenu() { remove_action('admin_menu', '_add_themes_utility_last', 101); } add_action('admin_init', 'remove_theme_submenus'); function remove_theme_submenus() { global $submenu; unset($submenu['themes.php'][5]); unset($submenu['themes.php'][7]); unset($submenu['themes.php'][15]); }

To disable other submenu names, go to ./wp-admin/menu.php and search for the item(s) you want to disable.

EDIT: As far as disabling by username, I would instead add a new capability to a role and use that as your removal condition see here. Otherwise, just use what you already were using, like so:

add_action('_admin_menu', 'remove_editor_submenu', 1); function remove_editor_submenu() { global $current_user; get_currentuserinfo(); if($current_user->user_login == 'username') { remove_action('admin_menu', '_add_themes_utility_last', 101); } } add_action('admin_init', 'remove_theme_submenus'); function remove_theme_submenus() { global $submenu, $current_user; get_currentuserinfo(); if($current_user->user_login == 'username') { unset($submenu['themes.php'][5]); unset($submenu['themes.php'][7]); unset($submenu['themes.php'][15]); } }

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2025-08-06 19:08 最后登录:2025-08-06 19:08
栏目列表
推荐内容