Hi @jb510
Firstly, thanks for using my plugin!
I am looking at fixing that up for a future version 🙂
Ben – see https://gist.github.com/jb510/0f31cdf0c667e983c94cfc290a6fc23b
wp_get_nav_menu_object() will return “false” ( a non-object ) when it’s empty… you just need to check that before continuing, more performant that way too 😀
$menu = wp_get_nav_menu_object( $locations[ $menu_name ] );
if (false != $menu) {
$menu_items = wp_get_nav_menu_items( $menu->term_id );
foreach( (array) $menu_items as $key => $menu_item ) {
[snip]
} // end foreach
} // end if
} // end menu1 - site-name menu
Thanks for your effort!
I’ll test and update the plugin 🙂
Hi @jb510,
I have included the conditionals you provided in an update I just released (1.0.4).
Thanks for your help and patience!