Created
February 22, 2016 17:34
-
-
Save danielbachhuber/ab6840c52bd480b5d254 to your computer and use it in GitHub Desktop.
Trigger Varnish cache purge on deploy to WP Engine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Didn't work for me. Could you recheck?