Title: foreach() error in sidebar.php
Last modified: August 18, 2016

---

# foreach() error in sidebar.php

 *  [mAg](https://wordpress.org/support/users/mag/)
 * (@mag)
 * [21 years, 1 month ago](https://wordpress.org/support/topic/foreach-error-in-sidebarphp/)
 * 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: [http://www.ality.org/wordpress/](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.

## Tags

 * [foreach](https://wordpress.org/support/topic-tag/foreach/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [mAg](https://wordpress.org/support/users/mag/)
 * Last activity: [21 years, 1 month ago](https://wordpress.org/support/topic/foreach-error-in-sidebarphp/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
