Tag: W3 Total Cache

Clear W3 Total Cache by URL From the Admin Bar or Dashboard

When recently working on a WordPress website that generated pages from an API that aren’t stored in the main site database, I discovered that the W3 Total Cache admin bar link to clear the current page’s cache didn’t work.

The ‘Purge Current Page’ link in the Performance menu item works by passing the current post ID to a function that clears the cache by an ID. Since this only works for single posts, it also doesn’t work on post archives and term listing pages.

So I wrote a small plugin to clear the current page’s cache by its URL.

Continue reading “Clear W3 Total Cache by URL From the Admin Bar or Dashboard” ››

Forcing W3 Total Cache to Clear Parent Term Listing Pages on Post Save

In the page caching settings of W3 Total Cache there is an option to flush the ‘Post Terms Pages’ when saving or updating a post. This clears the listing pages for any terms that the post has been added to, but it doesn’t clear the listing pages of any parent terms that aren’t checked, even though the post can still show on those pages.

The following code uses WordPress filters to detect a change in a post and then invalidate the cache of any parent term listing pages whether they have been checked or not.

Continue reading “Forcing W3 Total Cache to Clear Parent Term Listing Pages on Post Save” ››