Support » Fixing WordPress » remove_menu_page not working on some menu items

  • Resolved mannski


    I have a custom plugin that I’m using to hide admin menu pages from Administrators so that they can only be seen by Super Admins. It was working until I upgraded to 3.8.1, and now some admin menu pages that are supposed to be hidden are showing.

    Here’s the function:

    function s_remove_menu_pages() {
         if (!current_user_can('manage_network')){
    add_action('admin_init', 's_remove_menu_pages', 999);

    All of these pages except users.php are showing in the menu for Administrators.

    I’ve tried using admin_menu instead of admin_init. I’ve tried changing the number from 999 to a different (smaller) number.

Viewing 1 replies (of 1 total)
  • I fixed the issue. I’m not sure why this was causing a problem, but I had two dependences in my “if” statement:

    if (!current_user_can('manage_network') && other_function()) {

    When I removed the second dependency (so that it was the same as my first post), it worked fine.

Viewing 1 replies (of 1 total)
  • The topic ‘remove_menu_page not working on some menu items’ is closed to new replies.