在wordpress二次开发中,假如用到了W3 Total Cache插件,那么在程序中也许需要清空一下缓存, 研究了下W3 Total Cache的源码,发现可以用以下方法实现实时清空W3 Total Cache的缓存,而不用专门跑到它的设置页面清空
代码如下
  1. update_option('widget_unit2_settings',serialize($arr));
  2. if(class_exists('W3_Plugin_TotalCache')){
  3.      //flush cache
  4.      W3_Plugin_TotalCache::instance()->flush_all();
  5. }


随便说说

还可以输200