Return to Snippet

Revision: 69227
at May 12, 2015 23:52 by brownrl


Initial Code
SET @from_host = 'http://xxxxxx.hiddensaloon.com';
SET @to_host = 'http://www.xxxxxx.com';
UPDATE `wp_commentmeta` SET `meta_value` = REPLACE(`meta_value`, @from_host, @to_host); 
UPDATE `wp_comments` SET `comment_author_url` = REPLACE(`comment_author_url`, @from_host, @to_host);
UPDATE `wp_comments` SET `comment_content` = REPLACE(`comment_content`, @from_host, @to_host);
UPDATE `wp_icl_strings` SET `value` = REPLACE(`value`, @from_host, @to_host); 
UPDATE `wp_icl_string_positions` SET `position_in_page` = REPLACE(`position_in_page`, @from_host, @to_host); 
UPDATE `wp_icl_translation_status` SET `translation_package` = REPLACE(`translation_package`, @from_host, @to_host); 
UPDATE `wp_links` SET `link_url` = REPLACE(`link_url`, @from_host, @to_host);
UPDATE `wp_options` SET `option_value` = REPLACE(`option_value`, @from_host, @to_host);
UPDATE `wp_postmeta` SET `meta_value` = REPLACE(`meta_value`, @from_host, @to_host);
UPDATE `wp_posts` SET `guid` = REPLACE(`guid`, @from_host, @to_host);
UPDATE `wp_posts` SET `post_content` = REPLACE(`post_content`, @from_host, @to_host);
UPDATE `wp_site` SET `domain` = REPLACE(`domain`, @from_host, @to_host); 
UPDATE `wp_sitemeta` SET `meta_value` = REPLACE(`meta_value`, @from_host, @to_host); 
UPDATE `wp_usermeta` SET `meta_value` = REPLACE(`meta_value`, @from_host, @to_host);
UPDATE `wp_wprc_repositories` SET `repository_logo` = REPLACE(`repository_logo`, @from_host, @to_host);

Initial URL
http://www.itsgotto.be/cv

Initial Description
Moving a wordpress site for local dev, to staging, to production? This SQL snippet has done the job more often than not. It may not be 100% full proof but it has saved my butt hundreds of times. Please, if you know other tables or enhancements share them.

Initial Title
Migrate a Wordpress

Initial Tags
sql, wordpress

Initial Language
SQL