Purge Cache for CloudFlare

Purge  Cache for CloudFlare is a simple plugin for WordPress (download) that uses CloudFlare® API to purge cache of full HTML pages when a new post is made.

It works by purging front page, post’s page, and main RSS feed whenever post is created or edited. Also, it forces using of cached pages for commenters and using version that is not cached for logged in users.

This should work for most sites. However, there are filters, actions, and methods that provide full customizability and extensibility.

Note that this plugin also sets cache to 30 minutes for all frontend pages. This means that if you use default option in CloudFlare, it tells them to revalidate page cache after that time, so it means that cache for any page expires on CloudFlare servers after that time.

This free version is only intended for basic usage. If you want to use it in full capacity, consider buying premium version.


You should create new CloudFlare page rules to set proper caching. It is your responsibility to set this properly.

First page rule should exclude certain paths from caching. Recommended value for this path is wp-. This excludes admin pages, REST API, and default .php pages, or it other words all dynamic parts of the site. You can just set “Custom caching” value as “Default”. For other options you can set any setting or just leave default values. Example of URL pattern: *example.com/*wp-*

First page rule in CloudFlare settings

Second page rule should set caching. You need to set “Custom caching” to “Cache everything”. Recommended value for “Edge cache expire TTL” is default, “Respect all existing headers” which means that CloudFlare revalidates after 30 minutes, while for “Browser cache expire TTL” is also 30 minutes. Example of URL pattern: *example.com/*

Second page rule in CloudFlare settings

You can set page rules differently, however you should know what are you doing and you should take care that excluded path matches value of one in Purge Cache for CloudFlare and that “Edge cache expire TTL” matches value of cache timeout in Purge Cache for CloudFlare also. Default values in Purge Cache for CloudFlare can be changed by using Plus version of this plugin.

For setting plugin itself, go to Settings > Writing page and fill two fields with options that are necessary.

Purge Cache for CloudFlare Settings

You can find API key at your CloudFlare settings page while email address is one associated with you CloudFlare account.


Purge Cache for CloudFlare is in no way affiliated with CloudFlare. It is only using CloudFlare API to purge page cache of certain URLs. CloudFlare is registered trademark of CloudFlare, Inc.

Final Notes

Purge Cache for CloudFlare is released under the terms of GNU General Public License. It is completely free so if you find it useful you can give something back to author. Your help could be done by giving donation, translating plugin to your language, sending bugs and suggestions, promoting plugin in blogs, forums social networks, and other websites.

2 thoughts on “Purge Cache for CloudFlare

  1. Edge Expire TTL has changed under their page rules.
    It no longer provides the ability to respect all headers but allows a minimum of 2 hours. Does this make a difference?

    1. I haven’t tested every situation with the new settings as screenshots prove so I can’t tell definitive answer. When I release new plugin version it means that I tested everything.

Leave a Reply

Comment Guidelines:
  • Your email address will not be published
  • Fields marked with * are required
  • If you want your picture next to comment, open an account at Gravatar
  • If you want to know if someone replied to your comment, check “Notify me of followup comments via e-mail”
  • You can use these HTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>