From 2317fe252e7bb0f53470423ca3015deec2dd9d59 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 25 Oct 2018 10:48:43 -0400 Subject: [PATCH] Check for menu before trying to use it as object. Use only if $menu is there. --- setup/adminHooks.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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() { -- 2.17.1