移除WordPress后台的菜单和子菜单,直接上代码

啥也不说直接上代码,移除后台菜单:

add_action( 'admin_menu', 'lower_remove_admin_menus' );
function lower_remove_admin_menus(){
	remove_menu_page( 'index.php' );                  //Dashboard
	remove_menu_page( 'edit.php' );                   //Posts
	remove_menu_page( 'upload.php' );                 //Media
	remove_menu_page( 'edit.php?post_type=page' );    //Pages
	remove_menu_page( 'edit-comments.php' );          //Comments
	remove_menu_page( 'themes.php' );                 //Appearance
	remove_menu_page( 'plugins.php' );                //Plugins
	remove_menu_page( 'users.php' );                  //Users
	remove_menu_page( 'tools.php' );                  //Tools
	remove_menu_page( 'options-general.php' );        //Settings
}

 

移除子菜单:

remove_menu_page( 'options-general.php' );        //Settings

 

© 版权声明
THE END

喜欢就支持一下吧

点赞3 分享
评论 抢沙发

请登录后发表评论