Last active
December 17, 2015 15:19
-
-
Save matiskay/5631116 to your computer and use it in GitHub Desktop.
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
#! /bin/bash | |
OLD_URL='' | |
NEW_URL='' | |
PREFIX='wp_' # Default prefix. | |
echo "UPDATE ${PREFIX}_options SET option_value = replace(option_value, '$OLD_URL', '$NEW_URL') WHERE option_name = 'home' OR option_name = 'siteurl';" | |
echo "UPDATE ${PREFIX}_posts SET guid = REPLACE (guid, '$OLD_URL', '$NEW_URL');" | |
echo "UPDATE ${PREFIX}_posts SET post_content = REPLACE (post_content, '$OLD_URL', '$NEW_URL');" | |
echo "UPDATE ${PREFIX}_postmeta SET meta_value = REPLACE (meta_value, '$OLD_URL', '$NEW_URL');" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment