Edge Cache Getting Stale, After Creating Or Updating Post In Wordpress

Hi there,

When using the publish/update post option in WordPress, the Edge Cache is turning into stale.

I am Using the Cache Everything page rule.

CF-Cache Status for the old post pages that accessed is showing expired.

With the Cloudflare plugin (Automatic Cache Management option), it was showing CF-cache-status miss.

Below is the page rules

Browser cache: respect origin headers for .html 1 day and others 6 months.

In general, for an existing post that updated/edited or when published new post only for the specific URL the edge cache needs to show stale, for other cached pages it should be there (fresh).

But that is not the case. Edge cache completely going stale, followed by updated/edited or new post option.

Plz let me know your valuable inputs and suggestions.

Thanks

If you’re using the Cloudflare Plugin, it does a “Purge Everything” whenever you update content on your site. All pages will purge because of this.

Yes, but only if you change the theme or hit publish after making site-wide changes using WordPress’ built-in Customizer. In both cases, all pages AND static assets will return CF Cache Status: EXPIRED in the first subsequent visit.

When changes are made to specific posts, only that post URL is purged (assuming it was cached with Cache Everything) and returns a MISS.

What the OP seems to be experiencing is that after making changes to specific posts he’s seeing EXPIRED on all pages.

One possibility is that @geekworkscool is using a WordPress theme that invokes somehow the hook for the customizer (customize_save_after) whenever he modifies a page.

By calling the following hooks, the plugin will purge specific cache URLs:

  • deleted_post
  • edit_post
  • delete_attachment
  • autoptimize_action_cachepurged // for compatibility with the Autoptimize WordPress plugin

By calling the following hooks, the plugin will purge the entire site cache on Cloudflare:

  • switch_theme
  • customize_save_after
1 Like

all associated URLs containing that content will be purged from the Cloudflare cache

I’m not sure how the plugin figures this out, as many pages may be affected. When I look through my Audit Log, I’ve only seen “Purge Everything.”

Yeah, that description is a bit unclear. Browsing the plugin code, I’ve found this part that contains two functions related to cache purging. The first is purgeCacheByRevelantURLs(), the second being getPostRelatedLinks(). That one will check the database for taxonomies (categories, tags), author pages, feeds etc that are referenced by the post to be purged.

So I’m guessing what they mean by “all associated URLs” are these taxonomies, feeds etc related to any given post or page. But for instance if you delete a page that is linked to by a menu, and that menu is on all pages, the plugin won’t purge all pages until you go to the Customizer and update the menu itself, at which point the customize_save_after hook is triggered.

2 Likes

Found out, what causing the issue… it is not cloudflare plugin… It’s a cahce plugin that i was using… removed the integration has between cache and cloudflare. (only did api authentication part of the plugin instead of completing the integration and manually did settings by myself what cache plugin recommended ) Its working well now.

Cloudflare plugin only showing Miss for the page that updated. as for other pages it was showing HIT as it should be.

The thing is once a post is updated or new post is created, cache-headers are not showing for that post page . And i guess for .html part of the post.

So, i have to purge the page, and only after that creating fresh new cache, the cache-headers are appearing.

Thanks for the inputs… :slight_smile:

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.