Multisite instllation bug
-
There is endless loop of recurrence.
Loop is caused by “Already used name Error” which writes to database “error information”/string in place of proper “menu_id”/integer and forces a next attempt of creating menuFix explanation:
In place of just creating a new menu, i have added functionality that checks if menu already exist, and if it does , it returns menu_iddiff –git a/plugins/wp-nested-pages/app/Entities/NavMenu/NavMenuRepository.php b/plugins/wp-nested-pages/app/Entities/NavMenu/NavMenuRepository.php
index cd37076..af802b0 100644
— a/plugins/wp-nested-pages/app/Entities/NavMenu/NavMenuRepository.php
+++ b/plugins/wp-nested-pages/app/Entities/NavMenu/NavMenuRepository.php
@@ -112,8 +112,15 @@ class NavMenuRepository
*/
private function createNewMenu()
{
– $menu_id = wp_create_nav_menu(‘Nested Pages’);
– update_option(‘nestedpages_menu’, $menu_id);
+ $menu_name = ‘Nested Pages’;
+ $menu_ob = wp_get_nav_menu_object( $menu_name );
+ if(!$menu_ob){
+ $menu_id = wp_create_nav_menu($menu_name);
+ }
+ else{
+ $menu_id = $menu_ob->term_id;
+ }
+ update_option(‘nestedpages_menu’, $menu_id);
}/**
The topic ‘Multisite instllation bug’ is closed to new replies.