Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

musa-pro commented Mar 14, 2016

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