Skip to content

Instantly share code, notes, and snippets.

<?php
// This code snippet will purge the Nginx cache using the Nginx Helper if it's installed and active on the site
// You can add this to MainWP Code Snippets
// For the MainWP Snippet Type, choose "Return info from Child Sites"
// This may also work with ManageWP Code Snippets
global $nginx_purger;
if(isset($nginx_purger))
{
$nginx_purger->purge_all();
<?php
add_action( 'upgrader_process_complete', 'sentree_upgrader_process_complete', 10, 0 );
function sentree_upgrader_process_complete()
{
error_log('Upgrade process complete');
global $nginx_purger;
if(isset($nginx_purger))
{
$nginx_purger->purge_all();
<!-- Fix PDFs loaded in tabs -->
<script type="text/javascript">
jQuery(function() {
jQuery('.tab-link').click(function() {
setTimeout(function(){
if (typeof(Event) === 'function') {
// modern browsers
window.dispatchEvent(new Event('resize'));
} else {
// for IE and other old browsers