Title: Error with remove_menu_page() on export
Last modified: August 20, 2016

---

# Error with remove_menu_page() on export

 *  Resolved [dcrosbie](https://wordpress.org/support/users/dcrosbie/)
 * (@dcrosbie)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/error-with-remove_menu_page-on-export/)
 * I have 2 types of users – Admin and Contributor (with most privileges turned 
   off for Contributor).
 * For the Contributor I use remove_menu_page() WordPress function to hide unnecessary
   menu items. This works fine when the Contributor logs in and looks around, but
   as soon as they try to export their data they get this error inside the remove_menu_page()
   code:
 * _Warning: Invalid argument supplied for foreach() in /home/content/68/4872368/
   html/wp-admin/includes/plugin.php on line 1286_
 * This error doesn’t happen from the administrator’s id which does not use remove_menu_page().
   I can export no problem under administrator userid.
 * I am calling the remove_menu_page function during the admin_init action. It looks
   like maybe this action is being triggered a 2nd time during export and that is
   why the menu’s do not exist that 2nd time to be removed. Or… is this just a permission
   issue that I need some extra roles set up for the Contributor??
 * Any thoughts?
 * [http://wordpress.org/extend/plugins/contact-form-7-to-database-extension/](http://wordpress.org/extend/plugins/contact-form-7-to-database-extension/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [dcrosbie](https://wordpress.org/support/users/dcrosbie/)
 * (@dcrosbie)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/error-with-remove_menu_page-on-export/#post-3163900)
 * I love it when this happens, I found my solution thanks to google and other handy
   wordpress users!
 * See solution here:
    [http://wordpress.org/support/topic/using-remove_menu_page-causes-error-throughout-other-admin-sections?replies=5](http://wordpress.org/support/topic/using-remove_menu_page-causes-error-throughout-other-admin-sections?replies=5)
 * No a problem with this plugin at all.

Viewing 1 replies (of 1 total)

The topic ‘Error with remove_menu_page() on export’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/contact-form-7-to-database-extension_ffffff.
   svg)
 * [Contact Form DB](https://wordpress.org/plugins/contact-form-7-to-database-extension/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7-to-database-extension/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [dcrosbie](https://wordpress.org/support/users/dcrosbie/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/error-with-remove_menu_page-on-export/#post-3163900)
 * Status: resolved