I am trying to rename a menu item on my administration dashboard.
Using the $GLOBALS[‘menu’], I have found the following array indexes

[26.0648] => Array ( [0] => M.E. Calendar …

and

[26] => Array ( [0] => Products …

After using the following code:

global $menu;
global $submenu;
$menu[26.0648][0] = 'Event Calendar';

The result is that the “M.E. Calendar” item has not changed, whereas the Products item has changed to

[26] => Array
(
[0] => Event Calendar
[1] => edit_products
[2] => edit.php?post_type=product

Is there a way I can rename the menu item with the decimal array index number? Thanks.

1 Answer
1

You have to use a string as key:

$menu['26.0648'][0] = 'Event Calendar';

If you write the key as a number, it will truncate the decimal to an integer, so 26.0648 will be truncated to 26.

Leave a Reply

Your email address will not be published. Required fields are marked *