This plugin does not install nor configure a cache proxy. It acts as an interface with such services.
One common method of caching content for websites is via the use of reverse proxy caching. Common examples of this are Varnish and Nginx. These systems allow a website to update content and have the visitor’s experience cached without the need for complex plugins storing the files locally and using up a user’s disk space.
A reverse proxy cache is installed in front of a server and reviews requests. If the page being requested is already cached, it delivers the cached content. Otherwise it generates the page and the cache on demand.
The Proxy Cache Purge plugin sends a request to delete (aka flush) the cached data of a page or post every time it it modified. This happens when updating, publishing, commenting on, or deleting an post, and when changing themes.
How It Works
When content on a site is updated by WordPress, the plugin reaches out to the proxy cache service with the URL of the page, requesting the cache be deleted.
Not all page are deleted from the cache on every change. For example, when a post, page, or custom post type is edited, or a new comment is added, only the following pages will purge:
- The front page
- The post/page edited
- Any categories, tags, and/or custom taxonomies associated with the page
- Related feeds
- Associated JSON API pages
In addition, your entire cache will be deleted on the following actions:
- Changing themes
- Pressing the Empty Cache button on the toolbar
Plugins can hook into the purge actions as well, to filter their own events to trigger a purge.
On a multisite network using subfolders, only network admins can purge the main site.
If you’re working on a site and need to turn off caching in one of two ways:
define( 'VHP_DEVMODE', true );to your
- Go to Proxy Cache -> Settings and enable debug mode for 24 hours at a time
That will break cache on page loads. It is not recommended for production!
wp varnish purge– Flush the entire cache
wp varnish debug [<url>]– Help for debugging how well your cache is (or isn’t) working
wp varnish devmode [<activate|deactivate|toggle>– Change development mode state
By default, no data is tracked. If you use the site scanner/debugging tool, your domain and IP address will access a remote service hosted on DreamObjects. No personally identifying transaction data is recorded or stored, only overall usage. IP addresses of the website making the request may be recorded by the service, but there is no way to access them and use it to correspond with individuals or processes.
Use of this service is required for the cache checking in order to provide up to date compatibility checks on plugins and themes that may conflict with running a server based cache without needing to update the plugin every day.
No visitor information from your site is tracked.
DownloadLatest version: Download Varnish HTTP Purge v4.7.2 [zip]
No special instructions apply.
If you have a 3rd party proxy service (such as Sucuri or Cloudflare) you will need to add an IP address on the Proxy Cache -> Settings page. Alternatively you can add a define to your
When using Nginx based proxies, your IP will likely be
- Pretty Permalinks enabled
- A server based proxy cache service (such as Varnish or Nginx)
FAQQ. Is this plugin caching my data? A. No. This plugin tells your cache system when content is updated, and to delete the cached data at that time. Q. Why doesn’t the plugin automatically delete the whole cache? A. Speed and stability. Emptying too much of a cache on every change can slow a server down. This plugin does it’s best to determine what needs to be deleted and when, while providing hooks for developers to use as necessary. Q. Can I delete the entire cache? A. Yes. Click the ‘Empty Cache’ button on the “Right Now” Dashboard (see the screenshot if you can’t find it). There’s also an “Empty Cache” button on the admin toolbar. If you don’t see a button, then your account doesn’t have the appropriate permissions. Only administrators can empty the entire cache. In the case of a subfolder multisite network, only the network admins can empty the cache for the primary site. Q. Will the plugin delete my cache when I edit files on the server? A. No. WordPress can’t detect those file changes so it can’t tell your cache what to do. You will need to use the Empty Cache buttons when you’re done editing your code. Q. Does every WordPress plugin and theme work with a proxy cache? A. No. Some of them have behavior that causes them not to cache, either by accident or design. Q. I’m a developer, can I tell your cache to empty in my plugin/theme? A. Yes. Full documentation can be found on Custom Filters in the wiki. Q. Can I turn off caching? A. Kind of. You can use development mode to have WordPress tell your proxy service not to serve cached content, but the content will still be cached by the service. There are three ways to do this:
- Chose ‘Pause Cache (24hrs)’ from the Cache dropdown menu in your toolbar
- Go to Proxy Cache -> Settings and enable development mode
define( 'VHP_DEVMODE', true );to your
.htaccesssection for PageSpeed:
ModPagespeedModifyCachingHeaders offIf you’re using nginx, it’s
pagespeed ModifyCachingHeaders off;Q. Why aren’t my changes showing when I use CloudFlare or another proxy? A. When you use CloudFlare or any other similar service, you’ve put a proxy in front of the server’s proxy. In general this isn’t a bad thing, though it can introduce some network latency (that means your site may run slower because it has to go through multiple layers to get to the content). The problem arises when WordPress tries to send the purge request to your domain name and, with a proxy, that means the proxy service and not your website. On single-site, you can edit this via the Proxy Cache > Check Caching page. On Multisite, you’ll need to add the following to your wp-config.php file:
188.8.131.52with the IP of your Proxy Cache Server (not CloudFlare). DO NOT put http in this define. If you’re on nginx, you’ll want to use
localhostinstead of an IP address. If you want to use WP-CLI, you can set an option in the database. This will not take precedence over the define, and exists for people who want to use automation tools:
wp option update vhp_varnish_ip 184.108.40.2060Q. Why do I get a 503 or 504 error on every post update? A. Your IP address is incorrect. Check the IP of your server and then the setting for your proxy cache IP. If they’re not the same, that’s likely why. Q. How do I find the right IP address? A. Your proxy IP must be one of the IPs that the service is listening on. If you use multiple IPs, or if you’ve customized your ACLs, you’ll need to pick on that doesn’t conflict with your other settings. For example, if you have a Varnish based cache and it’s listening on a public and private IP, you’ll want to pick the private. On the other hand, if you told Varnish to listen on 0.0.0.0 (i.e. “listen on every interface you can”) you would need to check what IP you set your purge ACL to allow (commonly 127.0.0.1 aka localhost), and use that (i.e. 127.0.0.1). If your web host set up your service, check their documentation. Q. What if I have multiple proxy cache IPs? A. Multiple IPs are not supported at this time. Q. What version of Varnish is supported? A. This was built and tested on Varnish 3.x. While it is reported to work on 2.x and 4.x, it is only supported on v3 at this time. Q. Does this work with Nginx caching? A. It can, if you’ve configured Nginx caching to respect the curl PURGE request. If this doesn’t work, I recommend setting your Varnish IP to
localhostas Nginx requires a service control installed for the IP address to work. Q. What should my cache rules be? A. This is a question beyond the support of plugin. I do not have the resources available to offer any configuration help. Here are some basic gotchas to be aware of:
- To empty any cached data, the service will need to respect the PURGE command
- Not all cache services set up PURGE by default
- When flushing the whole cache, the plugin sends a PURGE command of
/.*and sets the
- Nginx expects the IP address to be ‘localhost’
- Yes, I do work for DreamHost
- No, this plugin is not DreamHost Only
- October 2018
- Fix regression with IP function name
- Restore “Right Now” activity box only for people who use WP.com toolbar
- October 2018
- Documentation: Cleaning up language and spelling
- October 2018
- WP-CLI: documentation
- Bugfix: Nginx compatibility
- Bugfix: Only enqueue CSS on front0end if the admin bar is used (props @mathieuhays)
- Feature: Rebranding
- Deprecation: “Right Now” button (not needed anymore)