Skip to content

Instantly share code, notes, and snippets.

@danielbachhuber
Created February 22, 2016 17:34
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielbachhuber/ab6840c52bd480b5d254 to your computer and use it in GitHub Desktop.
Save danielbachhuber/ab6840c52bd480b5d254 to your computer and use it in GitHub Desktop.
Trigger Varnish cache purge on deploy to WP Engine
<?php
add_action( 'init', function(){
// Replace '901bcc678021c0e12f1583085cafda1d' with a secret of your own.
if ( ! empty( $_GET['purge-cache'] ) && '901bcc678021c0e12f1583085cafda1d' === $_GET['purge-cache'] ) {
WpeCommon::purge_varnish_cache_all();
echo 'Cache purged';
exit;
}
});
@musa-pro
Copy link

Didn't work for me. Could you recheck?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment