Skip to content

Instantly share code, notes, and snippets.

@nawawi
Created January 6, 2025 16:44
Show Gist options
  • Save nawawi/808040031e5a42bba5bf152296c10849 to your computer and use it in GitHub Desktop.
Save nawawi/808040031e5a42bba5bf152296c10849 to your computer and use it in GitHub Desktop.
docketcache_flush_when_save_post.php
<?php
// Place this code in wp-content/mu-plugins/docketcache_flush_when_save_post.php
add_action('docketcache/init', function($docket_cache_instance) {
$docket_cache = $docket_cache_instance;
add_action( 'save_post', function($post_id, $post, $update) use($docket_cache) {
$result = $docket_cache->flush_cache(true);
$docket_cache->co()->lookup_set('occacheflushed', $result);
do_action('docketcache/action/flush/objectcache', $result);
}, 10, 3);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment