Title: Warning
Last modified: August 20, 2016

---

# Warning

 *  [Marco Chiesi](https://wordpress.org/support/users/marcochiesi/)
 * (@marcochiesi)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/warning-18/)
 * Hi there,
    I am using plugin 0.7-beta4 on WP 3.5.
 * I get the following error on a menu widget which uses “Current page’s top parent”
   as starting menu:
 * > Warning: Invalid argument supplied for foreach() in /home/xxxxx/public_html/
   > wp-content/plugins/gecka-submenu/models/NavMenuHacks.php on line 94
 * I fixed this by myself, hacking the plugin source code, by adding a check like`
   if (is_array($items))`, but I hope it will be fixed in next releases.
 * Thank you!
 * [http://wordpress.org/extend/plugins/gecka-submenu/](http://wordpress.org/extend/plugins/gecka-submenu/)

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

 *  Thread Starter [Marco Chiesi](https://wordpress.org/support/users/marcochiesi/)
 * (@marcochiesi)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/warning-18/#post-3352683)
 * P.s. there was a similar problem also around line 65:
 * > Warning: Invalid argument supplied for foreach() in /home/xxxxx/public_html/
   > wp-content/plugins/gecka-submenu/models/NavMenuHacks.php on line 65
 *  [bryanjlaz](https://wordpress.org/support/users/bryanjlaz/)
 * (@bryanjlaz)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/warning-18/#post-3352934)
 * Marco,
 * I have the same issues on line 94 & 65.
 * I am new with php. Can you explain how/where to add this code?
 * I have added… if (is_array($items)) …. at line 64, then took out and tried 66,
   then replaced 65 with it and nothin.. lol..
    Don’t laugh, just throwing darts..
 * Thanks..
 * Bryan
 *  [alejandrofm](https://wordpress.org/support/users/alejandrofm/)
 * (@alejandrofm)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/warning-18/#post-3352941)
 * Line 94 solve with: `if (is_array($items)) foreach($items as $item) {`
 * Line 65 continue the problem: `if (is_array($items)) foreach($posts as $key=>
   $post) {`
 * have you any idea to solve it?
 * Thanks!
 *  Thread Starter [Marco Chiesi](https://wordpress.org/support/users/marcochiesi/)
 * (@marcochiesi)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/warning-18/#post-3352942)
 * Here’s the code to fix the issue:
 * 1. File NavMenuHacks.php on line 65.
 * Change
    `foreach($posts as $key=>$post) {` to `if (is_array($posts)) foreach(
   $posts as $key=>$post) {`
 * 2. File NavMenuHacks.php on line 94.
 * Change
    `foreach($items as $item) {` to `if (is_array($items)) foreach($items
   as $item) {`
 * Note: the array names are different in the two cases.
 *  [alejandrofm](https://wordpress.org/support/users/alejandrofm/)
 * (@alejandrofm)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/warning-18/#post-3352943)
 * Yeeeeeeah, thanks you very much Marco… now work well.
 *  [Samantha Miller](https://wordpress.org/support/users/samantha-miller/)
 * (@samantha-miller)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/warning-18/#post-3352945)
 * Thank you very much Marco, this solves it for me.

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

The topic ‘Warning’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/gecka-submenu_f8f8f8.svg)
 * [Gecka Submenu](https://wordpress.org/plugins/gecka-submenu/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gecka-submenu/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gecka-submenu/)
 * [Active Topics](https://wordpress.org/support/plugin/gecka-submenu/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gecka-submenu/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gecka-submenu/reviews/)

 * 6 replies
 * 4 participants
 * Last reply from: [Samantha Miller](https://wordpress.org/support/users/samantha-miller/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/warning-18/#post-3352945)
 * Status: not resolved