Support » How-To and Troubleshooting » foreach() error in sidebar.php

foreach() error in sidebar.php

  • 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

    $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>
    <?php wp_get_links($link_cat->cat_id); ?>
    <?php } ?>

    Click Reload in Firefox, and the sidebar displays fine.

    URL: http://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.
Skip to toolbar