how to remove/hide wordpress plugin menu from admin dashboard

Viewed 49

i want to hide wp menu from my admin dashboard.. how remove/hide wordpress menu from admin dashboard .. i was try many code seems not work I want to hide yith_wacp_panel menu item s. How to remove yith_wacp_panel menu item in admin page? enter image description here

1 Answers

If you only want to hide it you can do this.

if (!function_exists('remove_menus')) {
  function remove_menus () {
    remove_menu_page('plugins.php');
  }
}
add_action('admin_menu', 'remove_menus');

Because we use a very generic function name I wrapped it in function_exists so we don't get a php error for redeclaring a function.
If this doesn't work it might be that the call back doesn't use our function, you can add a prefix, as you should anyway, to the function.
So something like this

if (!function_exists('bt_remove_menus')) {
  function bt_remove_menus () {
    remove_menu_page('plugins.php');
  }
}
add_action('admin_menu', 'bt_remove_menus');

Now with bt_ as our prefix (or anything else that you want) we are less likely to have issues

Related