简体   繁体   English

如何从wordpress管理菜单中隐藏此菜单?

[英]How to hide this menus from wordpress admin menu?

How do I hide the menus below from wordpress admin menu except for Admin: 除管理员外,如何从wordpress管理菜单中隐藏下面的菜单:

    admin.php?page=booki/index.php
    admin.php?page=booki/managegcal.php
    admin.php?page=booki/userhistory.php
    admin.php?page=booki/cancelledbookings.php
    admin.php?page=booki/reminders.php
    admin.php?page=booki/stats.php

I tried this for first one but not worked: 我尝试了第一个,但没有奏效:

    add_action( 'admin_menu', 'nstrm_remove_admin_submenus', 999 );
    function nstrm_remove_admin_submenus() {
    remove_submenu_page( 'admin.php', 'booki/index.php' );
     }

This menus are made by wordpress Booki plugin: www.booki.io 这个菜单由wordpress Booki插件制作:www.booki.io

I checked the plugin demo and the first admin menu on your list is the main/top admin menu page, so if you remove it the whole menu will disappear. 我检查了插件演示,列表中的第一个管理菜单是主/顶级管理菜单页面,因此如果删除它,整个菜单将消失。

If you really want to remove the whole menu, this should work: 如果你真的想要删除整个菜单,这应该工作:

add_action('admin_menu', 'so_40959455_admin_menu', 999);

function so_40959455_admin_menu() {

  remove_menu_page('booki/index.php');
}

If you just want to remove the other submenus, this should work: 如果您只想删除其他子菜单,这应该有效:

add_action('admin_menu', 'so_40959455_admin_menu', 999);

function so_40959455_admin_menu() {

  remove_submenu_page('booki/index.php', 'booki/managegcal.php');
  remove_submenu_page('booki/index.php', 'booki/userhistory.php');
  remove_submenu_page('booki/index.php', 'booki/cancelledbookings.php');
  remove_submenu_page('booki/index.php', 'booki/reminders.php');
  remove_submenu_page('booki/index.php', 'booki/stats.php');
}

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

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