From: Steve Sutton Date: Thu, 25 Oct 2018 14:48:43 +0000 (-0400) Subject: Check for menu before trying to use it as object. X-Git-Tag: v2.11.0^2~72 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=2317fe252e7bb0f53470423ca3015deec2dd9d59;p=WP-Plugins%2Fglm-member-db.git Check for menu before trying to use it as object. Use only if $menu is there. --- diff --git a/setup/adminHooks.php b/setup/adminHooks.php index 2886dbdc..2f167d2d 100644 --- a/setup/adminHooks.php +++ b/setup/adminHooks.php @@ -109,8 +109,10 @@ $locations = get_theme_mod( 'nav_menu_locations' ); if(!empty($locations)) { $menu = get_term_by('name', $menuName, 'nav_menu'); - $locations[$menuSlug] = $menu->term_id; - set_theme_mod('nav_menu_locations', $locations); + if ( $menu ) { + $locations[$menuSlug] = $menu->term_id; + set_theme_mod('nav_menu_locations', $locations); + } } add_action( 'add_meta_boxes', function() {