Update WordPress posts after site Move

Updating MySQL wp_posts to new URL or folder

When moving your WordPress site to a new folder or domain name, there is a little more you need to do than change the permalink structure and adding 301 into your .htaccess.

After performing the above steps you will need to make some database search and replace changes to get your data references 100% correct.

Change all references using old site URL:

UPDATE wp_posts SET guid = replace(guid, 'https://www.oldsite.co.uk/oldfolder','https://www.newsite.co.uk/newfolder');
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldsite.co.uk/oldfolder','https://www.newsite.co.uk/newfolder');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldsite.co.uk/oldfolder','https://www.newsite.co.uk/newfolder');

If you installed SSL, an additional search / replace is required:

UPDATE wp_posts SET post_content = replace(post_content, 'https://www.oldsite.co.uk/oldfolder','https://www.newsite.co.uk/newfolder');

Change all references using old folder name:

UPDATE wp_posts SET post_content = replace(post_content, '/oldfolder/','/newfolder/');

Was this helpful?
Update WordPress posts after site Move written by UKC average rating 5/5 - 1 user ratings