Skip to content

Instantly share code, notes, and snippets.

@jordantrizz
Last active June 11, 2020 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordantrizz/7e115810e0a2e7a6abad32c47fc5624c to your computer and use it in GitHub Desktop.
Save jordantrizz/7e115810e0a2e7a6abad32c47fc5624c to your computer and use it in GitHub Desktop.
Divi Purge Cache with nginx-helper plugin
<?php
/*
Plugin Name: Divi Plugin for Nginx Helper
Description: This is a GP helper plugin created for our customers.
Author: GridPane
Network: true
There is another function that you can use and assign it to the save page hook:
et_core_page_resource_auto_clear()
*/
if (!function_exists('untrailingslashit') || !defined('WP_PLUGIN_DIR')) {
// WordPress is probably not bootstrapped.
exit;
}
function clear_nginx_cache_for_divi($post_id) {
if ( class_exists( '\Nginx_Helper' ) ) {
global $nginx_purger;
$nginx_purger->purge_all();
}
}
// Found the necessary action using grep
add_action('et_save_post', 'clear_nginx_cache_for_divi');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment