Skip to content

Instantly share code, notes, and snippets.

@mattradford
Last active April 24, 2018 08:56
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 mattradford/865f3eefa0e6ebf341e6b9d76bce7d27 to your computer and use it in GitHub Desktop.
Save mattradford/865f3eefa0e6ebf341e6b9d76bce7d27 to your computer and use it in GitHub Desktop.
Programatically flush a WP Engine object cache
#!/bin/bash
# Programatically flush a WPE cache
# Requires https://github.com/a7/wpe-cache-flush/
# Set private key in $private_key
# @params install
# @params private_key
# @returns HTTP status code
# Variables
$private_key=YOUR_PRIVATE_KEY
# User input
read -p 'Install to flush: ' install
# Get site URL, flush cache and return status
echo $(tput setaf 2)'Attempting to flush '$install$(tput sgr 0)
remoteurl=$(wp --ssh=$install@$install.ssh.wpengine.net --quiet option get siteurl)
curl -I $remoteurl/?wpe-cache-flush=$private_key 2>/dev/null | head -n 1 | cut -d$' ' -f2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment