Support » Fixing WordPress » Receiving an Invalid Argument Error on homepage

  • Hello-
    I am new to this and was wondering if someone could help me understand why I am getting an error on my homepage and if this has to do with my hosting (which I did not set up , and I may actually have screwed up). Here is the error string:

    Warning: Invalid argument supplied for foreach() in /home/liztardo/public_html/home/wp-includes/class-wp-admin-bar.php on line 342

    Thank you in advance!!


Viewing 14 replies - 1 through 14 (of 14 total)
  • esmi


    Forum Moderator


    After updating to 3.3, I’m getting the same warning across the top of my blog:

    Warning: Invalid argument supplied for foreach() in /home/viola1/public_html/ on line 342

    I read the trouble shooting solutions and deactivated all my plug-ins, but it’s still there. I also deleted all of the inactive plug-ins.

    Not sure what to do now. I can get to the PHPMyAdmin in my cPanel, but don’t know what to do or look for after that.



    Okay, I tried the Twenty Eleven theme and the Warning went away. I was using the Liquorice Theme 2.2 by Nudge Design. If I’d like to continue to use this theme, do I wait until there is a fix or contact the creator for a fix or just change themes?


    I don’t want to use the Twenty Eleven theme either!! I need to use the theme that I’m currently using (Allure with the Placester plugin). Ahh. I hope someone else can help.



    Forum Moderator

    The steps suggested are part of the basic troubleshooting process.

    Going through the troubleshooting process – it’s the theme so should I…

    1) Wait for it to be fixed with WP 3.3.1

    2) Contact the theme developer for a fix

    3) Continue to use the theme with the error

    4) Change themes

    5) Venture into my PHPMyAdmin and hope for the best!

    liztardostroebel, were you able to find a fix yet?


    Hi Debra,

    I was also told it’s my theme. I contacted the theme developer and told them to look into it, but in the mean time I am looking for a new theme.

    I haven’t contacted the developer for my theme yet. I guess I’ll try that next, because I really don’t want to change themes. I’ve looked at a couple and can’t find anything close to the designs like the one I’m using.

    I’m doing a new post today and if everything goes okay, I might just sit it out for awhile with the error. Only I can see it, I hope. I’m going to ask someone on another computer to check out my site after I do the post and see how it looks.

    Fingers crossed!

    I have such problem in the old theme developed few years ago. In my case the problem was in footer.php – the function <?php wp_footer(); ?> called there two times ( First wp_footer(); second do_action(‘wp_footer’); )

    The message

    Warning: Invalid argument supplied for foreach() in /home/liztardo/public_html/home/wp-includes/class-wp-admin-bar.php on line 342

    appears if the code:

    foreach ( $root->children as $group ) {
    	$this->_render_group( $group );

    is called several times.

    Moderator Sergey Biryukov


    WordPress Dev

    This warning indeed appears if a theme has two wp_footer() calls in footer.php, or both do_action('wp_footer') and wp_footer().

    There should be only one call, right before </body>.

    Thanks! My theme had 2 instances of wp_footer(). Problem solved.

    Same here, I had this under the </html>
    <?php do_action(‘wp_footer’); ?>
    Another with more code above. I removed the <?php do_action(‘wp_footer’); ?> and all is now working. This appeared after the upgrade to WP 3.3.


    Same problem. “Elements of SEO” theme.
    I had a do_action and a wp_footer call in the footer.php file.
    Removed one and it’s fine now.
    Not sure if I originally added one or the other call, or whether it’s like that as it comes. Either way, remove one or the other and it’s sorted.

    It worked! I removed the second ‘<?php wp_footer(); ?>’ in the footer.php and left the one right before /body and the error is gone.

    Appreciate the help. Thanks!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Receiving an Invalid Argument Error on homepage’ is closed to new replies.