Archived topic
Problem updating link paths in Sections content after site migration
5 replies · Started by Daniel Walker on October 2, 2015
Hi Tom,
I'm having problems updating the link paths in my Sections content after I've migrated my site from localhost to my webserver.
I've followed the standard practice of migrating a WP site, and have created the new site in a subfolder on the Windows shared host webserver that current hosts our current live website. So the new site sits in http://MySite/~SubFolder while I test it.
I've updated the Site and Home URLs, the Permalinks, and replaced any 'localhost' paths with the new 'My/Site/~SubFolder' path using a SQL query in wp_posts.post_content and wp_postmeta.meta_value (as that seems to be where Section content is stored).
Now if open the home page - which uses Sections - I get the following warnings and the site doesn't load properly:
Warning: Invalid argument supplied for foreach() in E:\Domains\s\MySiteURL\user\htdocs\~SubFolder\wp-content\plugins\generate-sections\functions\generate-sections.php on line 151
Skip to content
• Home
• Menu item 1
• Menu item 2
• Menu item 3
• Menu item 4
Search for:
Warning: Invalid argument supplied for foreach() in E:\Domains\s\MySiteURL\user\htdocs\~SubFolder\wp-content\plugins\generate-sections\functions\templates\generate-sections-page-template.php on line 27
Any ideas why that's happening? I wondered if updating the link paths in Sections using a SQL query was breaking it, but I can't think of how to do it in the WP dashboard without manually changing each one.
I can email you the actual site URL if you want to have a look. Just let me know.
Thanks in advance.
Dan
Hi Dan,
I find that searching and replacing directly in the database can cause some issues sometimes - things can get corrupted.
Can you try using a plugin like this?: https://wordpress.org/plugins/duplicator/
It does everything for you, and should bring the Sections over without any issues.
Let me know :)
Hi Tom,
Yes we tried Duplicator yesterday but we had to update the version of PHP running on the webserver so the installer.php script could run. (Unfortunately updating PHP actually broke our live website (oops), so after running the Duplicator installer we had to put PHP back down to 5.2.)
Anyway, the links didn't get updated after installing with Duplicator either.
I'll give Duplicator another try on Monday and let you know how it goes.
Thanks,
Dan
That's super weird - those errors you're getting are because the page thinks it should be displaying Sections, but it can't find the data in the database to display them, so it spits out those errors.
So somehow, certain data isn't being pulled over in the database from one server to the other.
It could be a PHP thing (5.2 is old), but I doubt it. I've personally used Duplicator and BackupBuddy to move GP sites using Sections with no issue so far.
Let me know how it goes on Monday :)
Hi Tom, I tried Duplicator again yesterday after updating PHP to 5.4 on the webserver and it worked much better this time. Just a few links here and there that didn't get updated (e.g. links in footer widgets) but the site and page sections work - no PHP errors - so it's all good.
Cheers,
Dan
Hi Dan,
Good to hear! Using the latest versions of PHP is always a good call :)
