• Dear Chouby (and maybe other experts who have an idea how to ressolve this),

    I discovered that Polylang causes a problem when certain menus are used for wp_get_nav_menu_items().

    I have ‘primary’ and ‘secondary’ menu locations registered in my theme. Secondary only includes the language switcher, so it is used in all languages. Primary, however, uses different menus in all languages (DE, EN, FR).

    This works:

    $menu_name = 'secondary';
    $locations = get_nav_menu_locations();
    $menu_object = wp_get_nav_menu_object( $locations[ $menu_name ] );
    $menu = wp_get_nav_menu_items($menu_object->term_id);

    This does not work and causes an infinite loop

    $menu_name = 'primary';
    $locations = get_nav_menu_locations();
    $menu_object = wp_get_nav_menu_object( $locations[ $menu_name ] );
    $menu = wp_get_nav_menu_items($menu_object->term_id);

    Also with “primary___en” and “primary___fr” it does not work. Once I deactivate Polylang, it works again with “primary”.

    Please let me know if you have any idea how to ressolve this.

    Thanks and kind regards
    joschi81

    • This topic was modified 7 years, 4 months ago by winnewoerp.
Viewing 1 replies (of 1 total)
  • Thread Starter winnewoerp

    (@joschi81)

    Hi there,

    I was hoping to get a hint here, so I’m trying again: Has anyone got an idea how to resolve this?

    Kind regards
    joschi81

Viewing 1 replies (of 1 total)
  • The topic ‘wp_get_nav_menu_items() causes infinite loop with Polylang’ is closed to new replies.