#47901 closed defect (bug) (invalid)
Admin menu variable is not always considered as global
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Administration | Keywords: | |
| Focuses: | administration, coding-standards | Cc: |
Description
In "wp-admin/menu.php", the variable $menu is used as global but never declared as global, this cause issue if you are displaying admin from a router script in PHP by using a require_once.
Bug can be solved by adding to "wp-admin/menu.php"
<?php /** * Build Administration Menu. * * @package WordPress * @subpackage Administration */ /** * Constructs the admin menu. * * The elements in the array are : * 0: Menu item name * 1: Minimum level or capability required. * 2: The URL of the item's file * 3: Class * 4: ID * 5: Icon for top level menu * * @global array $menu */ global $menu; // <- This line
Change History (4)
#2
@
6 years ago
I believe there are also $menu_order & $default_menu_order in 'wp-admin/includes/menu.php' if we consider explicitly declaring them as global.
#3
@
5 months ago
- Keywords 2nd-opinion removed
- Resolution set to invalid
- Status changed from new to closed
Hi all,
It's been 6+ years since this was opened and we've seen no other requests for it. I'm going to close this ticket to help clean up Trac. Feel free to reopen if more info comes to light that describes a bug that should be fixed.
Note: See
TracTickets for help on using
tickets.
Hi @philippevienne,
Welcome to WordPress Trac! Thanks for the ticket.
If we consider the
$menufor global variable then the same way we have to consider$submenufor global also.