Last active
December 10, 2020 10:39
-
-
Save tangrufus/f5189a1d0177dee23d013c4f7741571e to your computer and use it in GitHub Desktop.
This file contains 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('save_post', function($id, $post, $update): void { | |
if (! $update) { | |
return; | |
} | |
$postType = get_post_type($id); | |
// TODO: Change to the correct post type! | |
if ('post' !== $postType) { | |
return; | |
} | |
// Skip if beaver builder is not activated. | |
if (method_exists('FLBuilderModel','delete_asset_cache_for_all_posts')) { | |
\FLBuilderModel::delete_asset_cache_for_all_posts(); | |
} | |
// Skip if wp rocket is not activated. | |
if (function_exists('rocket_clean_domain')) { | |
\rocket_clean_domain(); | |
} | |
// TODO: Remove after testing! | |
wp_die('Purge Triggered'); | |
}, PHP_INT_MAX, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment