Migrating WordPress Site Database SQL Queries

Use this to update your database via the SQL interface when migrating a WordPress site

UPDATE wp_options SET option_value = replace(option_value, 'http://oldurl', 'http://newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://oldurl', 'http://newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://oldurl', 'http://newurl');
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://oldurl','http://newurl');
view raw migrate.sql hosted with ❤ by GitHub

Source: https://gist.github.com/joshuadavidnelson/8c77a2ac63cbd8509f1a

Tags: