-
-
Save meSingh/4755363 to your computer and use it in GitHub Desktop.
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
<?php | |
$mysql_host = 'localhost'; | |
$mysql_user = ''; | |
$mysql_pass = ''; | |
$mysql_base = 'wordpress_database'; | |
$old_domain = 'http://blog.gbaptista.com'; | |
$new_domain = 'http://local.blog.gbaptista.com'; | |
if($conn = mysql_connect($mysql_host, $mysql_user, $mysql_pass)) { | |
mysql_select_db($mysql_base, $conn); | |
} else { | |
echo mysql_error(); mysql_close($conn); exit; | |
} | |
mysql_query("UPDATE wp_posts SET guid=REPLACE(guid, '$old_domain', '$new_domain') WHERE guid LIKE '%$old_domain%'"); | |
mysql_query("UPDATE wp_options SET option_value=REPLACE(option_value, '$old_domain', '$new_domain') WHERE option_value LIKE '%$old_domain%'"); | |
echo "\nDone! [$old_domain to $new_domain] =)\n\n"; | |
mysql_close($conn); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment