Last active
February 4, 2020 16:11
-
-
Save alexleone/93db97e7c102f6dfd4dd53e4d9058e56 to your computer and use it in GitHub Desktop.
Use the WP CLI to update a wordpress site url, home url, and the DB references.
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
# Note the current urls to later be used in DB update | |
# use the flag --allow-root if only have a root user | |
wp option get siteurl | |
wp option get home --allow-root | |
wp option update home 'https://example.com' | |
wp option update siteurl 'https://example.com' | |
# Search and replace all the old urls to reference the new one | |
wp search-replace 'http://example.test' 'http://example.com' | |
# Restart webserver | |
service apache2 restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment