Created
October 14, 2025 12:42
-
-
Save nawawi/23c4ce425530cdb70f5e467742e68bf7 to your computer and use it in GitHub Desktop.
docketcache_flush_when_plugin_update.php
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 | |
| // Place this code in wp-content/mu-plugins/docketcache_flush_when_plugin_update.php | |
| add_action('docketcache/init', function($docket_cache_instance) { | |
| $docket_cache = $docket_cache_instance; | |
| add_action( 'upgrader_process_complete', function($wp_upgrader, $options) use($docket_cache) { | |
| if ('update' !== $options['action']) { | |
| return; | |
| } | |
| $result = $docket_cache->flush_cache(true); | |
| $docket_cache->co()->lookup_set('occacheflushed', $result); | |
| do_action('docketcache/action/flush/objectcache', $result); | |
| }, 10, 3); | |
| }, \PHP_INT_MAX, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment