4

I have a question.

How can I clear the cache when a post is submitted ? Actually, I need to clear two speficied pages which display these articles ? By default, I have noticed the index.php is cleared automatically when a post is submitted. But not Archive page or Category page...

Thanks in advance.

EDIT : By the way, how to clear only a specific page with W3 Total Cache ?

Example : Clear /blog.php

11

Hm, I am not sure but I think that whole cache should be invalidated on publishing of new post... Had you tried to enable debug info in W3TC and check why are those pages aren't refreshed?

As for manual cache clear, from plugin's FAQ:

How can I flush the cache without using the WP Admin interface?

It's possible to empty the entire cache or simply purge the cache of a single post / page:

Purge the entire page cache: if (function_exists('w3tc_pgcache_flush')) { w3tc_pgcache_flush(); }

Purge a single post / page by passing it's ID:

if (function_exists('w3tc_pgcache_flush_post')) { w3tc_pgcache_flush_post($post_id); }

  • Wow ! w3tc_pgcache_flush_post($post_id); seems really good. I'll try this and I'll be back to you. Can you give the FAQ of W3TC where you found this please ? – Steffi Apr 12 '11 at 14:58
  • @Steffi see menu of installed W3TC :) – Rarst Apr 12 '11 at 15:04
  • @Rarst Thanks ! And is it possible to set multiple $post_id with the function w3tc_pgcache_flush_post($post_id) ? – Steffi Apr 12 '11 at 15:11
  • 1
    @Steffi no idea, as I said in my answer - I don't think it should remain cached when new post is posted anyway. You might be better off asking W3TC developer about your issue. – Rarst Apr 12 '11 at 16:14
  • 1
    @PrafullaKumarSahu sorry, Hadn't used W3TC in years, you will have to start with their current documentation probably. – Rarst Nov 17 '16 at 9:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.