morganestes
2/22/2016 - 5:34 PM

Trigger Varnish cache purge on deploy to WP Engine

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;
	}
});