Blog

Replacing WordPress URLs with SQL command

WARNING – Always make a backup before modifying your database. This came really handy when you have to manually migrate a WordPress website to another domain. UPDATE wp_options SET option_value = replace(option_value, ‘http://oldsite.url’, ‘http://newsite.url’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’; UPDATE wp_posts SET guid = replace(guid, ‘http://oldsite.url’,’http://newsite.url’); UPDATE wp_posts SET post_content = replace(post_content,… Continue reading