• Hi,

    I am using the plugin W3 Total Cache but now I need to clear the cache automatically when an entry is posted. How can this be done? I have tried to create a function in the functions.php file of my template but it does not work well. I paste the code I use.

    function post_delete_cache( $ID, $post ) {
    	if (function_exists('w3tc_pgcache_flush')) {
    		w3tc_pgcache_flush();
    		w3tc_flush_all();
    	} 
    }
    add_action( 'publish_post', 'post_delete_cache', 10, 2 );

    Can anybody help me? Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • I will suggest you use WP Fastest Cache plugin for site speed and auto clear cache. By the way W3 Total Cache clear posts cache on update or publish a post.

    Thread Starter angelfcarrero

    (@angelfcarrero)

    Thanks for your answer but I can not change the W3 Total Cache plugin. I need to work with it and do what I said. Any ideas?

    Hey angel if you use w3 total cache then whatever the code you put in functions.php file it won’t work due to cache.
    Hey guys i m using this plugin and it is working good but i dont know if we use cache then why its not calling the functions.php file of active theme.
    for example people from us can visit the site then they can see some other content and other visitor from rest of countries can see different content as well but due to cache i can not achieve these
    if do you have any idea then please let me know

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Clean cache automatically when you publish’ is closed to new replies.