What does Automatic Cache Management in the Cloudflare Plugin do?

The Cloudflare WordPress plugin contains a feature known as Automatic Cache Management. When a user adds/edits/deletes a post, page, attachment or comment - all associated URLs containing that content will be purged from the Cloudflare cache. When you switch a theme or customise a theme within the WordPress admin panel, the cache will automatically be cleared too.

This feature works great when caching HTML on WordPress with the Bypass Cache on Cookie setting.

How do I enable Automatic Cache Management?

After installing the WordPress plugin, click on Settings menu and select "Cloudflare", on that page you will see an Automatic Cache setting:

After clicking "Enable" beside this setting, you will be asked to confirm you want to enable this:

What WordPress hooks does this feature use?

This feature uses the native hooks built into WordPress.

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
Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.