Why do menus break on site url and folder change?

When you do mysql query find and replace of strings in databases with wordpress, you can break the serialized data and essentially breaks the links between required tables and table columns.

Your only option is to restore the database before you ran those queries. In wp_options change ONLY the ‘siteurl’ and the ‘home’ url’s to suit your new domain.

if you have hard coded links in your content and want to save time. you could try running:

UPDATE wp_posts
SET post_content= REPLACE(post_content, 'olddomain.com', 'newdomain.com');

UPDATE wp_posts
SET guid= REPLACE(guid, 'olddomain.com', 'newdomain.com');

That will take care of 99% of your old domain links without breaking your widgets or theme options. I would suggest manually editing your menu’s, widgets and theme options from there which should not take you long with the content and media being updated with the above queries.

If you want to do it another way. You could restore the original database. Change the siteurl and home url’s in wp_options. Once you get into wp-admin after that on the new domain.

You could use one of the following plugins which will keep serialized data in tact (apparently)

https://wordpress.org/plugins/better-search-replace/

https://wordpress.org/plugins/search-and-replace/