Advertisement
swte

Swift Performance automated clear cache after plugin update

Oct 31st, 2019
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1. function swift_clear_cache_after_update(){
  2.     Swift_Performance_Cache::clear_all_cache();
  3.     delete_option('swift_performance_messages');
  4. }
  5.  
  6. if (class_exists('Swift_Performance_Cache')){
  7.     // Theme/Plugin or core update finished
  8.     add_action('upgrader_process_complete', 'swift_clear_cache_after_update', 1, PHP_INT_MAX); 
  9.  
  10.     // Any plugin was deactivated
  11.     add_action('deactivated_plugin', 'swift_clear_cache_after_update', 1, PHP_INT_MAX);
  12.  
  13.     // Any plugin was activated
  14.     add_action('activated_plugin', 'swift_clear_cache_after_update', 1, PHP_INT_MAX);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement