Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save VelichkoAlexander/7ba3b71ac5af9a1e4ae036fea480b1b8 to your computer and use it in GitHub Desktop.
Save VelichkoAlexander/7ba3b71ac5af9a1e4ae036fea480b1b8 to your computer and use it in GitHub Desktop.
<?php
add_action('save_post', function($id, $post, $update): void {
// Skip if wp rocket is not activated.
if (! function_exists('rocket_clean_domain')) {
return;
}
if (! $update) {
return;
}
$postType = get_post_type($id);
// TODO: Change to the correct post type!
if ('post' !== $postType) {
return;
}
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