Support » Plugin: User Menus - Nav Menu Visibility » Uncaught TypeError

  • Resolved dregad


    Just tested this plugin with WP 5.9.2, PHP 8.0.

    When opening the wp-admin/nav-menus.php page, I get:

    Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, string given in .../wp-content/plugins/user-menus/includes/classes/admin/menu-settings.php:162 Stack trace: 
    #0 .../wp-content/plugins/user-menus/includes/classes/admin/menu-settings.php(162): in_array('administrator', 'in', true) 
    #1 .../wp-includes/class-wp-hook.php(309): JP\UM\Admin\Menu_Settings::fields('3237', Object(WP_Post), 1, Object(stdClass)) 
    #2 .../wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array) 
    #3 .../wp-includes/plugin.php(474): WP_Hook->do_action(Array) 
    #4 .../wp-admin/includes/class-walker-nav-menu-edit.php(251): do_action('wp_nav_menu_ite...', '3237', Object(WP_Post), 1, Object(stdClass), 0) 
    #5 .../wp-includes/class-wp-walker.php(146): Walker_Nav_Menu_Edit->start_el('\t\t<li id="menu-...', Object(WP_Post), 1, Object(stdClass)) 
    #6 .../wp-includes/class-wp-walker.php(158): Walker->display_element(Object(WP_Post), Array, 0, 1, Array, '\t\t<li id="menu-...') 
    #7 .../wp-includes/class-wp-walker.php(246): Walker->display_element(Object(WP_Post), Array, 0, 0, Array, '\t\t<li id="menu-...') 
    #8 .../wp-includes/nav-menu-template.php(608): Walker->walk(Array, 0, Object(stdClass)) 
    #9 .../wp-admin/includes/nav-menu.php(1094): walk_nav_menu_tree(Array, 0, Object(stdClass)) 
    #10 .../wp-admin/nav-menus.php(578): wp_get_nav_menu_to_edit(38) 
    #11 {main} thrown in .../wp-content/plugins/user-menus/includes/classes/admin/menu-settings.php on line 162
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support mark l chaves


    Hey @dregad,

    We’re sorry you’re getting that TypeError.

    We’ve been running WP 5.9.2, PHP 8.0, and User Menus 1.2.9 for a while now with no errors.

    Have you tried ruling out a plugin or theme conflict yet?

    Here’s how you do that.

    If you’re still seeing the issue after all that, can you submit a ticket via our contact form?

    That way we can get more details from you and take a closer look.


    Thread Starter dregad


    Hi Mark,

    Many thanks for your quick reply and the tip about a potential plugin conflict.

    I’ve just gone through the whole exercise of disabling all plugins and re-enabling them one-by-one, and I found the culprit:

    Nav Menu Roles,

    I’ve been using that plugin for a few years now, it allows me to restrict access to some menu items based on whether the user is connected or not, and if they are, their roles.

    I hope Your plugin may be able to achieve the same goal, I need to test that. If so, then I’ll uninstall that Nav Menu Roles.

    Plugin Support mark l chaves


    Hey @dregad,

    Thanks so much for letting us know about the conflict. Having more than 1 menu restriction plugin can definitely step on some toes.

    If you have any more questions or get stuck anywhere using User Menus, don’t hesitate to give us a yell.

    Have a great weekend šŸ™‚

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Uncaught TypeError’ is closed to new replies.