Skip to content

Instantly share code, notes, and snippets.

@JGrubb
Created June 22, 2017 13:52
Show Gist options
  • Save JGrubb/0eb923c114679ca72e6e34a751dec440 to your computer and use it in GitHub Desktop.
Save JGrubb/0eb923c114679ca72e6e34a751dec440 to your computer and use it in GitHub Desktop.
Deploy hook for multisite WP (call from deploy hook)
#!/bin/bash
OLDURL='YOURSITE.COM'
NEWURL=$(echo $PLATFORM_ROUTES | base64 --decode | awk -F'"' '{print $2}' | awk -F"/" '{print $3}')
if [[ $PLATFORM_BRANCH != "master" ]]; then
php wp-cli search-replace $OLDURL $NEWURL 'wp_*options' wp_blogs wp_usermeta wp_site wp_sitemeta --skip-columns=guid
else
echo "This is the master branch, skipping URL replace."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment