admin管理员组文章数量:1304098
I need to change the capability required for an added admin menu page. By default the plugin added the capability manage_options which I need to change. How can I change this without editing the plugin file?
I need to change the capability required for an added admin menu page. By default the plugin added the capability manage_options which I need to change. How can I change this without editing the plugin file?
Share Improve this question edited Feb 4, 2021 at 13:33 Rup 4,4004 gold badges29 silver badges29 bronze badges asked Feb 4, 2021 at 10:02 Akash SinghAkash Singh 113 bronze badges 1- Even if there is a hook for that, I'd guess you'd need to change the permission check on the page it links to which I doubt you could do with a hook. – Rup Commented Feb 4, 2021 at 10:28
1 Answer
Reset to default 1The functioning of the code below depends a lot on how the plugin in question was built.
add_action( 'admin_menu', 'change_capability' );
function change_capability() {
remove_menu_page(
$menu_slug,
);
add_menu_page(
$page_title,
$menu_title,
$new_capability,
$menu_slug,
);
}
本文标签: user rolesHow I can change the required capability for an admin menu without editing the plugin file
版权声明:本文标题:user roles - How I can change the required capability for an admin menu without editing the plugin file? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741774603a2396950.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论