WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I noticed today that my error logs are littered with this information. I'm not quite sure what's causing it. Has anyone seen this before?

[Mon Mar 25 17:24:23 2013] [error] [client] PHP Warning: Invalid argument supplied for foreach() in /var/www/html/mysite/wp-admin/includes/plugin.php on line 1290, referer: http://mysite/contact/

Line 1290 is the foreach in the following code. I am not sure what's referencing this or where to begin looking.

 * Remove a top level admin menu
 * @since 3.1.0
 * @param string $menu_slug The slug of the menu
 * @return array|bool The removed menu on success, False if not found

function remove_menu_page( $menu_slug ) {
global $menu;

foreach ( $menu as $i => $item ) {
    if ( $menu_slug == $item[2] ) {
        unset( $menu[$i] );
        return $item;

return false;

I'm not hooking into admin_menu as far as I can tell.

Any ideas?

share|improve this question
This is most likely caused by a plugin. Deactivate them all, and reactivate one by one. – vancoder Mar 25 '13 at 21:34
Looks like I narrowed it down to a plugin, which tells me I must have been getting this error for a few months and just didn't notice. Pop that one liner into an answer and I'll check it off for you. Thanks @vancoder – Pat Mar 25 '13 at 22:04
Was it a Twitter (or twitter related) plugin perchance? they've recently updated their API so a lot of plugins are failing. – vancoder Mar 25 '13 at 22:15
No it was WP Most Popular (which for what it's worth, never seemed to work rock-solid anyways). wordpress.org/extend/plugins/wp-most-popular – Pat Mar 25 '13 at 22:16
up vote 1 down vote accepted

This is most likely caused by a plugin. Deactivate them all, and reactivate one by one.

share|improve this answer
Thanks for the easy fix! – Pat Mar 25 '13 at 22:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.