/ Published in: SQL
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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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);
URL: http://www.itsgotto.be/cv