Open netson opened 9 years ago
What is an exact menu hierarchy that I can use to reproduce this bug?
It's a simple, flat menu, not the primary one:
* Link /
* Page 1
* Page 2
* Page 3
* Page 4
* Page 5
The copier hangs on Page 1 (always the first one, I tried reordering them, then still hangs on the top one).
The odd thing is, that Page 1 does actually exist in the destination blog (slug = identical). And to make it even more strange, it's not consistent because sometimes it does hang on Page 1, and sometime it doesn't. I've even had the situation where I copied the menu, got the error, deleted the menu (in the destination), copied it again, and it worked as expected. No changes were made to the pages in the meantime.
I tried debugging to see if I could find the issue, but haven't been able to pinpoint the issue yet.
If you need me to test anything, let me know!
I've done some exploration, and here is what is happening
If you have a WP_POST object (Post, Page, Custom Post Type...) that doesn't exist on the destination site, it will not be copied and everything after it will not be copied.
I did some debugging, and menus aren't being copied because a WP_Error is thrown "Invalid Menu ID". However, I can't yet understand why this is happening because the menu is already created.
The error should be shown in two case:
I'll spend some more time on this hopefully tomorrow. I just need you to confirm if this is the exact bug that's happening on your side.
The way you describe it sounds exactly like what I am seeing in my environment. Just to be clear, I do not get the Invalid Menu ID error, I get a "Page 1 Not Found" error whenever this occurs.
Hi, I haven't been able to figure out yet what exactly is going on, but when I copy a menu where only 1 item is missing in the destination blog, it stops copying altogether. So when the first item is missing, no other menu items are copied after that; when the second item is missing, only the first is copied, etc.
The log just shows the one missing menu item.
It would be great if the other items were still copied (if they exist), that would be a huge time saver!
Keep up the good work! :+1: