#6422 closed defect (bug) (fixed)
Admin Menu bug
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | 2.5 |
Component: | Administration | Keywords: | |
Focuses: | Cc: |
Description
I suspect this one will be a bit tricky... :)
If you create a theme with a file name that is included in the submenu already, then the menu no longer works as expected.
To reproduce: Create a theme with a file called widgets.php, include that file from the functions.php, and from that file, register an admin screen using:
add_submenu_page( 'themes.php', __('Whatever'), __('Whatever'), 'switch_themes', basename(__FILE__), 'foobar' );
Upon doing so, wp-admin/widgets.php is no longer available -- that menu item points to themes.php?page=widgets.php instead.
I'm guessing this also works with plugins. I also vaguely recall a weird bug reported by Ozh that might be related to this one.
Change History (6)
#2
@
16 years ago
- Keywords reporter-feedback removed
It is.
In function.php:
include dirname(__FILE__) . '/widgets.php';
In the theme's widgets.php file:
<?php function foo() { add_submenu_page( 'themes.php', __('Whatever'), __('Whatever'), 'switch_themes', basename(__FILE__), 'bar' ); } function bar() { echo 'bar'; } add_action('admin_menu', 'foo'); ?>
Browse Appearance / Widgets -> It no longer is available.
Fixing it will likely be complex, as I'm guessing one would need to mess around with the way the menu and submenu global arrays are keyed.
#4
@
16 years ago
You know the simple way to solve this? Get people to stop using filenames for the 5th param and instead use a string, It looks prettier & Its guaranteed to work. but hmm.. Probably is related to #6478
I couldn't reproduce this accurately. Is it still a problem?