migration - Why do menus break on site url and folder change?

I just moved a site over from an old domain to a new domain (this means the server-side folder changes too).I replaced a

I just moved a site over from an old domain to a new domain (this means the server-side folder changes too).

I replaced all instances of the old domain in the database with the new domain and couldn't find any instances of the directory name. I checked that nowhere in the database the old domain or directory name are mentioned (at least not in plain text).

Various stuff inexplicably broke, one of them being all menus: They vanished (the theme has logic to hide the menus if they are empty, so maybe that was triggered). Deleting and recreating them worked, but I'd like to automate that.

Can someone explain to me how the menus depend on the domain in a way that doesn't show up in the database in plain-text? Is the url encoded somehow so my regular expressions don't find it?

I just moved a site over from an old domain to a new domain (this means the server-side folder changes too).

I replaced all instances of the old domain in the database with the new domain and couldn't find any instances of the directory name. I checked that nowhere in the database the old domain or directory name are mentioned (at least not in plain text).

Various stuff inexplicably broke, one of them being all menus: They vanished (the theme has logic to hide the menus if they are empty, so maybe that was triggered). Deleting and recreating them worked, but I'd like to automate that.

Can someone explain to me how the menus depend on the domain in a way that doesn't show up in the database in plain-text? Is the url encoded somehow so my regular expressions don't find it?

Share Improve this question asked Dec 6, 2019 at 23:23 NobodyNobody 1315 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

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', 'newdomain');

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

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/plugins/better-search-replace/

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744929857a4601667.html

相关推荐

  • migration - Why do menus break on site url and folder change?

    I just moved a site over from an old domain to a new domain (this means the server-side folder changes too).I replaced a

    2天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信