From 232269b34ee88414a2c317e77e7f36a65a5f68a1 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 9 May 2013 02:43:26 +0000 Subject: [PATCH] Don't show "Manage Locations" tab if the theme has no menu locations defined. props DrewAPicture. fixes #24115. git-svn-id: https://develop.svn.wordpress.org/trunk@24217 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/nav-menus.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wp-admin/nav-menus.php b/wp-admin/nav-menus.php index 9da80dcc7a..821508913d 100644 --- a/wp-admin/nav-menus.php +++ b/wp-admin/nav-menus.php @@ -351,6 +351,11 @@ switch ( $action ) { } break; case 'locations': + if ( ! $num_locations ) { + wp_redirect( admin_url( 'nav-menus.php' ) ); + exit(); + } + add_filter( 'screen_options_show_screen', '__return_false' ); if ( isset( $_POST['menu-locations'] ) ) { @@ -466,7 +471,7 @@ add_filter('admin_body_class', 'wp_nav_menu_max_depth'); wp_nav_menu_setup(); wp_initial_nav_menu_meta_boxes(); -if ( ! current_theme_supports( 'menus' ) && ! wp_get_nav_menus() ) +if ( ! current_theme_supports( 'menus' ) && ! $num_locations ) $messages[] = '

' . __('The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar.') . '

'; if ( ! $locations_screen ) : // Main tab @@ -532,7 +537,9 @@ require_once( './admin-header.php' );