• Running wp 1.5, a modified Connections (renamed to Gone_Fishing) theme, and I recently added Weather Report plugin.

    Periodically, I get the following error:
    Warning: Invalid argument supplied for foreach() in /var/www/html/wordpress/wp-content/themes/gone_fishing/sidebar.php on line 4


    <?php
    $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories WHERE (cat_id <> 19) ORDER BY cat_id desc");
    foreach ($link_cats as $link_cat) {
    ?>
    <h2 id="linkcat-<?php echo $link_cat->cat_id; ?>">
    <?php echo $link_cat->cat_name; ?></h2>
    <ul>
    <?php wp_get_links($link_cat->cat_id); ?>
    </ul>
    </li>
    <?php } ?>

    Click Reload in Firefox, and the sidebar displays fine.

    URL: https://www.ality.org/wordpress/
    Would really like to see the error go away permanently. Seems that when the error is returned, that there seems to be a longer than usual wait for anything to render in the browser.

  • The topic ‘foreach() error in sidebar.php’ is closed to new replies.