title: wordpress function remove_menu_page() throws an error
body: <p>I am trying to remove a few top-level menus on wordpress admin panel. Oddly enough I get an error message from the plugin.php file, where the function is declared, saying: 
  <strong>"Invalid argument supplied for foreach() in C:\wamp\www\wordpress-alut\wp-admin\includes\plugin.php on line 1261"</strong>.
  I went to the file and found the following code:</p>
  
  <pre><code>function remove_menu_page( $menu_slug ) {
      global $menu;
  
      foreach ( $menu as $i =&gt; $item ) { // **this is line 1261**
          if ( $menu_slug == $item[2] ) {
              unset( $menu[$i] );
              return $item;
          }
      }
  
      return false;
  }
  </code></pre>
  
  <p>It is important to note that when I use remove_<strong>submenu</strong>_page(), which is the next function in plugin.php, I get no such error.
  my function, located in functions.php :</p>
  
  <pre><code>add_action( 'admin_init', 'mf_remove_menu_pages' );
  function mf_remove_menu_pages() {
      remove_menu_page('link-manager.php');
      remove_menu_page('index.php');
      remove_menu_page('users.php');
      remove_menu_page('upload.php');
      remove_menu_page('tools.php');
      remove_menu_page('edit.php');
      remove_menu_page('edit-comments.php');
      remove_menu_page('post-new.php');
      remove_submenu_page('themes.php','themes.php');
      remove_submenu_page('themes.php','theme-editor.php');
      remove_submenu_page('themes.php','widgets.php');
  }; 
  </code></pre>