Title: Line 157 Error
Last modified: November 17, 2016

---

# Line 157 Error

 *  Resolved [polis01](https://wordpress.org/support/users/polis01/)
 * (@polis01)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/line-157-error/)
 * I am getting an error reported to the top of my dashboard: “supplied for foreach()
   in /home/c119123472/public_html/wp-content/plugins/google-maps-widget/gmw-tracking.
   php on line 157”
 * Can you help? I have reinstalled the plugin with no luck.
 * Looking near line 157 I see this below, with line 157 beginning with “for each”:
 *     ```
       // counts the number of active GMW widgets in sidebars
         static function count_active_widgets() {
           $count = 0;
   
           $sidebars = get_option('sidebars_widgets', array());
           foreach ($sidebars as $sidebar_name => $widgets) {
             if (strpos($sidebar_name, 'inactive') !== false || strpos($sidebar_name, 'orphaned') !== false) {
               continue;
             }
             if (is_array($widgets)) {
               foreach ($widgets as $widget_name) {
                 if (strpos($widget_name, 'googlemapswidget') !== false) {
                   $count++;
                 }
               }
             }
           } // foreach sidebar
       ```
   
    -  This topic was modified 9 years, 8 months ago by [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/).
      Reason: put code in code tags
    -  This topic was modified 9 years, 8 months ago by [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [WebFactory](https://wordpress.org/support/users/webfactory/)
 * (@webfactory)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/line-157-error/#post-8449380)
 * We’ll recheck that loop, bugs can always creep in 🙁 Sorry.
    Do you actually 
   have any widgets on that site? GMW or not …
 *  Thread Starter [polis01](https://wordpress.org/support/users/polis01/)
 * (@polis01)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/line-157-error/#post-8449458)
 * I have resolved this. It seems that post-migration the default widgets in the
   sidebar did not populate on the new website, I placed the widgets I had populated
   in development in production in the same order and the error went away. Thank
   you for your speedy reply!
 *  [WebFactory](https://wordpress.org/support/users/webfactory/)
 * (@webfactory)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/line-157-error/#post-8449486)
 * You’re welcome! Glad you got it fixed. Still, we obviously have a bug 🙂
 *  Thread Starter [polis01](https://wordpress.org/support/users/polis01/)
 * (@polis01)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/line-157-error/#post-8449508)
 * Glad I could help then too! Thanks for a great product!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Line 157 Error’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [polis01](https://wordpress.org/support/users/polis01/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/line-157-error/#post-8449508)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
