WordPress.org

Ready to get started?Download WordPress

Forums

Foreach error (7 posts)

  1. salromano
    Member
    Posted 1 year 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. alchymyth
    Forum Moderator
    Posted 1 year 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 1 year ago #

  4. alchymyth
    Forum Moderator
    Posted 1 year 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 1 year 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. alchymyth
    Forum Moderator
    Posted 1 year ago #

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

  7. salromano
    Member
    Posted 1 year 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