Skip to content

Instantly share code, notes, and snippets.

@campaignupgrade
Created March 10, 2019 00:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save campaignupgrade/3ea1f4b56822670be7743b9db12cc1df to your computer and use it in GitHub Desktop.
Save campaignupgrade/3ea1f4b56822670be7743b9db12cc1df to your computer and use it in GitHub Desktop.
Finds WordPress root from any subdirectory in the WordPress install
while [ ! -e wp-config.php ]; do
if [ $pwd/ = / ]; then
echo "No Wordpress root found" >&2; exit 1
fi
cd ../
done
if [ -e wp-config.php ]; then
wproot=$(pwd)
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment