Last active
December 23, 2015 18:09
-
-
Save wpsmith/6673714 to your computer and use it in GitHub Desktop.
SQL: Replace URLs in guid, post_content, & pinged. Change WPPREFIX to wp_ or whatever your prefix is. For Multi-Site, change {WPPREFIX}{SITEID} to wp_8 or your prefix + site ID.
This file contains hidden or 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
| -- wp_posts | |
| -- GUID | |
| UPDATE {WPPREFIX}{SITEID}_posts SET guid = REPLACE (guid, 'http://oldsite.com', 'http://mthorebumc.com'); | |
| -- Post Content | |
| UPDATE {WPPREFIX}{SITEID}_posts SET post_content = REPLACE (post_content, 'http://oldsite.com', 'http://newsite.com'); | |
| -- Pinged | |
| UPDATE {WPPREFIX}{SITEID}_posts SET pinged = REPLACE (pinged, 'http://oldsite.com', 'http://newsite.com'); | |
| -- Options | |
| UPDATE {WPPREFIX}{SITEID}_options SET option_value = replace(option_value, 'http://oldsite.com', 'http://newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl' OR option_name = 'avatar_default' OR option_name = 'fileupload_url' OR option_name = 'wppa_bc_url' OR option_name = 'wp_dlm_image_url'; | |
| -- wp_postmeta | |
| UPDATE {WPPREFIX}{SITEID}_postmeta SET meta_value = replace(meta_value, 'http://oldsite.com', 'http://newsite.com') | |
| UPDATE {WPPREFIX}{SITEID}_usermeta SET meta_value = replace(meta_value, 'http://oldsite.com', 'http://newsite.com') | |
| -- wp_taxonomymeta (if table exists) | |
| UPDATE {WPPREFIX}{SITEID}_taxonomymeta SET meta_value = replace(meta_value, 'http://oldsite.com', 'http://newsite.com') | |
| -- Gravity Forms: wp_rg_lead | |
| UPDATE {WPPREFIX}{SITEID}_rg_lead SET source_url = replace(source_url, 'http://oldsite.com', 'http://newsite.com') | |
| UPDATE wp_rg_lead_detail SET value = replace(value, 'http://oldsite.com', 'http://newsite.com') | |
| -- Links | |
| UPDATE {WPPREFIX}{SITEID}_links SET link_image = replace(link_image, 'http://oldsite.com', 'http://newsite.com') |
This file contains hidden or 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
| -- wp_posts | |
| -- GUID | |
| UPDATE WPPREFIX_posts SET guid = REPLACE (guid, 'http://oldsite.com', 'http://newsite.com'); | |
| -- Post Content | |
| UPDATE WPPREFIX_posts SET post_content = REPLACE (post_content, 'http://oldsite.com', 'http://newsite.com'); | |
| -- Pinged | |
| UPDATE WPPREFIX_posts SET pinged = REPLACE (pinged, 'http://oldsite.com', 'http://newsite.com'); | |
| -- Options | |
| UPDATE WPPREFIX_options SET option_value = replace(option_value, 'http://oldsite.com', 'http://newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl' OR option_name = 'avatar_default' OR option_name = 'fileupload_url' OR option_name = 'wppa_bc_url' OR option_name = 'wp_dlm_image_url'; | |
| -- wp_postmeta | |
| UPDATE WPPREFIX_postmeta SET meta_value = replace(meta_value, 'http://oldsite.com', 'http://newsite.com') | |
| UPDATE WPPREFIX_usermeta SET meta_value = replace(meta_value, 'http://oldsite.com', 'http://newsite.com') | |
| -- wp_taxonomymeta (if table exists) | |
| UPDATE WPPREFIX_taxonomymeta SET meta_value = replace(meta_value, 'http://oldsite.com', 'http://newsite.com') | |
| -- Gravity Forms: wp_rg_lead | |
| UPDATE WPPREFIX_rg_lead SET source_url = replace(source_url, 'http://oldsite.com', 'http://newsite.com') | |
| UPDATE wp_rg_lead_detail SET value = replace(value, 'http://oldsite.com', 'http://newsite.com') | |
| -- Links | |
| UPDATE WPPREFIX_links SET link_image = replace(link_image, 'http://oldsite.com', 'http://newsite.com') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment