Last active
June 11, 2020 23:21
-
-
Save jordantrizz/7e115810e0a2e7a6abad32c47fc5624c to your computer and use it in GitHub Desktop.
Divi Purge Cache with nginx-helper plugin
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 | |
/* | |
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