From ab530a67d507b2ecd41c68dcc325672bccfb1188 Mon Sep 17 00:00:00 2001 From: rob1n Date: Thu, 3 May 2007 00:43:57 +0000 Subject: [PATCH] Don't show Widgets admin page if core widgets aren't enabled. fixes #4218 git-svn-id: http://svn.automattic.com/wordpress/trunk@5376 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/menu.php | 1 - wp-includes/functions.php | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 4e09015830..383abeb799 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -67,7 +67,6 @@ $submenu['plugins.php'][5] = array(__('Plugins'), 'activate_plugins', 'plugins.p $submenu['plugins.php'][10] = array(__('Plugin Editor'), 'edit_plugins', 'plugin-editor.php'); $submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php'); -$submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_themes', 'widgets.php' ); $submenu['themes.php'][10] = array(__('Theme Editor'), 'edit_themes', 'theme-editor.php'); // Create list of page plugin hook names. diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 68e73cb13e..e163cd7978 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1506,6 +1506,10 @@ function wp_parse_args( $args, $defaults = '' ) { function wp_maybe_load_widgets() { if ( !function_exists( 'dynamic_sidebar' ) ) { require_once ABSPATH . WPINC . '/widgets.php'; + + if ( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) !== false && isset( $GLOBALS['submenu'] ) ) { + $GLOBALS['submenu']['themes.php'][7] = array( __( 'Widgets' ), 'edit_themes', 'widgets.php' ); + } } }