From b37894c3486709ee3f774616df974dafebd6a047 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 2 Mar 2010 17:56:24 +0000 Subject: [PATCH] Fix is_nav_menu(). Props Utkarsh. see #11817 git-svn-id: http://svn.automattic.com/wordpress/trunk@13550 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/nav-menu.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/wp-includes/nav-menu.php b/wp-includes/nav-menu.php index 27c85ba012..60cce801cc 100644 --- a/wp-includes/nav-menu.php +++ b/wp-includes/nav-menu.php @@ -30,17 +30,22 @@ function wp_get_nav_menu_object( $menu ) { * @return mixed Menu Object, if exists. */ function is_nav_menu( $menu ) { - if ( $menu ) { - $menu = get_term( $menu, 'nav_menu' ); - } elseif ( !$menu ) { - $menu = get_term_by( 'slug', $menu, 'nav_menu' ); - } elseif( !$menu ) { - $menu = get_term_by( 'name', $menu, 'nav_menu' ); - } else { - $menu = false; + if ( !$menu ) + return false; + + $menu_obj = get_term( $menu, 'nav_menu' ); + + if ( !$menu_obj ) + $menu_obj = get_term_by( 'slug', $menu, 'nav_menu' ); + + if ( !$menu_obj ) + $menu_obj = get_term_by( 'name', $menu, 'nav_menu' ); + + if ( !$menu_obj ) { + $menu_obj = false; } - - return $menu; + + return $menu_obj; } /**