... | ... | @@ -4,9 +4,8 @@ Adicionei uma nova funçao para limpar o cache cada vez que roda essas funçoes |
|
|
|
|
|
|
|
|
```
|
|
|
require_once(ABSPATH . '/wp-admin/includes/plugin.php');
|
|
|
// Verifica se o plugin w3-total-cache está ativado.
|
|
|
if (is_plugin_active('w3-total-cache/w3-total-cache.php')) {
|
|
|
function check_plugin_w3tc_state(){
|
|
|
if (is_plugin_active('w3-total-cache/w3-total-cache.php')){
|
|
|
//Limpa todo o cache do redis qundo faz algumas dessas açoes 'save, delete, trash'
|
|
|
add_action( 'save_post', 'flush_redis_save_post' );
|
|
|
add_action( 'delete_post', 'flush_redis_save_post' );
|
... | ... | @@ -15,7 +14,9 @@ if (is_plugin_active('w3-total-cache/w3-total-cache.php')) { |
|
|
{
|
|
|
w3tc_flush_all();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
add_action('admin_init', 'check_plugin_w3tc_state');
|
|
|
`````
|
|
|
|
|
|
|
... | ... | |