简体   繁体   English

通过Wordpress中的插件隐藏/删除仪表板设置选项卡

[英]Hide/Remove dashboard settings tab through plugin in Wordpress

I want to remove wordpress dashboard settings tab using plugin. 我想使用插件删除wordpress仪表板设置选项卡。 I don't want users to access settings tab when my plugin is activated. 激活插件后,我不希望用户访问“设置”选项卡。 I have google for it and found below code but its not working. 我有谷歌为它,发现下面的代码,但不能正常工作。

function remove_menus(){
  remove_menu_page( 'options-general' );       //Settings tab
}

add_action( 'admin_menu', 'remove_menus' );

Any help will be appreciated. 任何帮助将不胜感激。

function remove_menus(){
  remove_menu_page( 'options-general.php' );  // slug should be the menu (typically the name of the PHP script for the built in menu item     
}

add_action( 'admin_menu', 'remove_menus' );

Note: the user can still access the screen if he enters the url directly 注意:如果用户直接输入网址,仍然可以访问屏幕

Almost... You need to specific a full php filename as per the examples 几乎...您需要根据示例指定完整的php文件名

https://codex.wordpress.org/Function_Reference/remove_menu_page https://codex.wordpress.org/Function_Reference/remove_menu_page

remove_menu_page( 'options-general.php' );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM