Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 918 Bytes

File metadata and controls

26 lines (21 loc) · 918 Bytes

SQL commands for database migration

Repository with basic commands for WordPress migration. Fell free to improve.

To use it you must replace the table prefix and your old and new URLs.

Here is the file with the commands below

Change "siteurl" or "homeurl"

UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl.com', 'http://www.newurl.com')
WHERE option_name = 'home' OR option_name = 'siteurl';

Change GUID

UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.oldurl.com', 'http://www.newurl.com');

Change content URL

UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://www.oldurl.com', 'http://www.newurl.com');

Change post meta

UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://www.oldurl.com','http://www.newurl.com');