wp_get_nav_menu_items() causes infinite loop with Polylang
-
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
- The topic ‘wp_get_nav_menu_items() causes infinite loop with Polylang’ is closed to new replies.