WordPress.org

Forums

Foreach error (7 posts)

  1. salromano
    Member
    Posted 2 years ago #

    I've got this foreach error showing up in my sidebar: http://gematsu.com/

    Warning: Invalid argument supplied for foreach() in /home/scrawlf/public_html/wp-content/themes/layout/disqusRecentComments.php on line 79

    It's very weird how it started. I didn't make any modifications to the theme or install any plugins I wasn't already using, so it can't be that. It just started showing up. And oddly enough, sometimes it shows the error. Other times it shows what's supposed to be there. To see this, try refreshing the page a few times.

    Any support would be great!

  2. Michael
    Forum Moderator
    Posted 2 years ago #

    what is the code in that file:

    /wp-content/themes/layout/disqusRecentComments.php

    - please use the pastebin; http://codex.wordpress.org/Forum_Welcome#Posting_Code

  3. salromano
    Member
    Posted 2 years ago #

  4. Michael
    Forum Moderator
    Posted 2 years ago #

    posibly change line 94 of the pastebin (there is no 'foreach' in line 79; the lines have possibly shifted when you posted the code) to:

    if( $comment ) foreach($comment as $commentObj)
  5. salromano
    Member
    Posted 2 years ago #

    Looks like everything's working now! Loaded a few different pages and the error hasn't appeared yet. Thanks!

    Edit: Spoke too soon. There it goes again.

  6. Michael
    Forum Moderator
    Posted 2 years ago #

    as you have 'W3 Total Cache' activated, make sure you are not looking at cached pages.

  7. salromano
    Member
    Posted 2 years ago #

    I know. I cleared the cache several times immediately after editing the code. =/

    [Please don't bump]

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags