Title: Undefined array key 2 in menu.php
Last modified: November 14, 2023

---

# Undefined array key 2 in menu.php

 *  [Matt Scheidler](https://wordpress.org/support/users/matt6303/)
 * (@matt6303)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/undefined-array-key-2-in-menu-php/)
 * I am seeing this line in my php.error.log for multiple websites that are using
   your plugin. Every time a user logs in to WordPress, it’s generating approximately
   160 lines in the log that all say this:
   Undefined array key 2 in /home/xxxxxx/
   public_html/wp-content/plugins/advanced-access-manager/application/Core/Object/
   Menu.php on line 136
 * Is it possible to put the code in a conditional, or otherwise make a change that
   doesn’t result in so many warnings being logged?
 * I’m glad to provide more information if it would be helpful. Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [AAM Plugin](https://wordpress.org/support/users/vasyltech/)
 * (@vasyltech)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/undefined-array-key-2-in-menu-php/#post-17247392)
 * Thank you [@matt6303](https://wordpress.org/support/users/matt6303/) for the 
   feedback.
 * The issue you described is caused due corrupted global variable $submenu and 
   this is not a bug. It is most likely that you have some plugin or theme that 
   corrupts it and I would recommend finding the one that does it because it probably
   causes some other side effects on your website that you may not be aware of.
 * Meantime we will update AAM to better work with corrupted submenu data to avoid
   rendering these notifications.
 * Thank you.
 *  [Brian_Milnes](https://wordpress.org/support/users/brian_milnes/)
 * (@brian_milnes)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/undefined-array-key-2-in-menu-php/#post-17257143)
 * Hi, I’m also seeing errors generated in the log file – is this the same issue?
 * /wp-content/plugins/advanced-access-manager/application/Service/AdminMenu.php
   on line 214
   [06-Dec-2023 13:11:40 UTC] PHP Notice: Undefined offset: 2 in /wp-
   content/plugins/advanced-access-manager/application/Service/AdminMenu.php on 
   line 328[06-Dec-2023 13:11:40 UTC] PHP Notice: Undefined offset: 2 in /wp-content/
   plugins/advanced-access-manager/application/Service/AdminMenu.php on line 332[
   06-Dec-2023 13:11:40 UTC] PHP Notice: Undefined offset: 2 in /wp-content/plugins/
   advanced-access-manager/application/Service/AdminMenu.php on line 332[06-Dec-
   2023 13:11:40 UTC] PHP Notice: Undefined offset: 2 in /wp-content/plugins/advanced-
   access-manager/application/Service/AdminMenu.php on line 332[06-Dec-2023 13:11:
   40 UTC] PHP Notice: Undefined offset: 2 in /wp-content/plugins/advanced-access-
   manager/application/Service/AdminMenu.php on line 332[06-Dec-2023 13:11:40 UTC]
   PHP Notice: Undefined offset: 2 in /wp-content/plugins/advanced-access-manager/
   application/Service/AdminMenu.php on line 332[06-Dec-2023 13:11:40 UTC] PHP Notice:
   Undefined offset: 2 in /wp-content/plugins/advanced-access-manager/application/
   Service/AdminMenu.php on line 332[06-Dec-2023 13:11:40 UTC] PHP Notice: Undefined
   offset: 2 in /wp-content/plugins/advanced-access-manager/application/Service/
   AdminMenu.php on line 332[06-Dec-2023 13:11:40 UTC] PHP Notice: Undefined offset:
   2 in /wp-content/plugins/advanced-access-manager/application/Service/AdminMenu.
   php on line 332[06-Dec-2023 13:11:40 UTC] PHP Notice: Undefined offset: 2 in /
   wp-content/plugins/advanced-access-manager/application/Service/AdminMenu.php 
   on line 332[06-Dec-2023 13:11:40 UTC] PHP Notice: Undefined offset: 2 in /wp-
   content/plugins/advanced-access-manager/application/Service/AdminMenu.php on 
   line 241
 * Thanks
 *  Plugin Author [AAM Plugin](https://wordpress.org/support/users/vasyltech/)
 * (@vasyltech)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/undefined-array-key-2-in-menu-php/#post-17257185)
 * Thank you [@brian_milnes](https://wordpress.org/support/users/brian_milnes/),
 * We’ve adjusted AAM functionality to work with corrupted menu data and this will
   be released in upcoming AAM 6.9.19 version.
 * However, I must warn you as well that there is some plugin or theme on your website
   that corrupts WordPress core submenu variable and that may affect other features
   on your website beyond AAM.
 * Regards.
 *  [Brian_Milnes](https://wordpress.org/support/users/brian_milnes/)
 * (@brian_milnes)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/undefined-array-key-2-in-menu-php/#post-17257193)
 * Thanks!
 *  Thread Starter [Matt Scheidler](https://wordpress.org/support/users/matt6303/)
 * (@matt6303)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/undefined-array-key-2-in-menu-php/#post-17257233)
 * Original poster here. Thank you for the update.
 * In my troubleshooting, it appears as though these log entries only happen when
   an non-Administrator role logs in. When I log in as an admin it doesn’t happen,
   but when my clients log in as Editor it does.
 * It’s not happening on all my AAM sites. Most of the ones where it is happening
   are 5-8 year old sites, and possibly there is some common denominator, though
   I haven’t found it. But one of the sites with the issue was just launched a few
   months ago, and doesn’t have all that much in common with the sites I was building
   years ago.
 * For now, I’m happy for your upcoming adjustment. Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Undefined array key 2 in menu.php’ is closed to new replies.

 * ![](https://ps.w.org/advanced-access-manager/assets/icon-256x256.png?rev=3447421)
 * [Advanced Access Manager – Access Governance for WordPress](https://wordpress.org/plugins/advanced-access-manager/)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-access-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-access-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-access-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-access-manager/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Matt Scheidler](https://wordpress.org/support/users/matt6303/)
 * Last activity: [2 years, 6 months ago](https://wordpress.org/support/topic/undefined-array-key-2-in-menu-php/#post-17257233)
 * Status: not resolved