Opened 5 years ago
Last modified 5 years ago
#47901 new defect (bug)
Admin menu variable is not always considered as global
Reported by: | philippevienne | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Administration | Keywords: | 2nd-opinion |
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 (2)
Note: See
TracTickets for help on using
tickets.
Hi @philippevienne,
Welcome to WordPress Trac! Thanks for the ticket.
If we consider the
$menu
for global variable then the same way we have to consider$submenu
for global also.