-
-
Save HDDen/1086da551a60ea254596f8e6ad60d1fb to your computer and use it in GitHub Desktop.
SQL queries for moving WordPress website to a new domain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE wp_options SET option_value = REPLACE(option_value, 'https://dev.mysite.com', 'https://mysite.com') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET post_content = REPLACE (post_content, 'https://dev.mysite.com', 'https://mysite.com'); | |
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'https://dev.mysite.com','https://mysite.com'); | |
UPDATE wp_comments SET comment_content = REPLACE (comment_content, 'https://dev.mysite.com', 'https://mysite.com'); | |
UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 'https://dev.mysite.com','https://mysite.com'); | |
UPDATE wp_posts SET guid = REPLACE (guid, 'https://dev.mysite.com', 'https://mysite.com') WHERE post_type = 'attachment'; | |
-- мультисайт | |
UPDATE wp_blogs SET domain = REPLACE (domain, 'dev.mysite.com', 'mysite.com'); | |
UPDATE wp_site SET domain = REPLACE (domain, 'dev.mysite.com', 'mysite.com'); | |
UPDATE wp_sitemeta SET meta_value = REPLACE (meta_value, 'https://dev.mysite.com', 'https://mysite.com') WHERE meta_key = 'siteurl'; | |
UPDATE wp_users SET user_url = REPLACE (user_url, 'https://dev.mysite.com', 'https://mysite.com'); | |
/* затем накатываем better search replace и заменяем тоже | |
/dev.mysite.com -> /mysite.com | |
https://dev.mysite.com -> https://mysite.com | |
*/ | |
/* wp-config.php: | |
define( 'DOMAIN_CURRENT_SITE', 'mysite.com' ); | |
define( 'WPCACHEHOME', '/var/www/www-root/data/www/mysite.com/wp-content/plugins/wp-super-cache/' ); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment