About this plugin
Most page caches store one copy of a page. That breaks every site that renders a page differently per country: a WooCommerce shop that shows prices including the VAT rate of the visitor’s country, or a site that sends first-time visitors from abroad to its English version. Cache such a site and every visitor sees the prices of whoever happened to fill the cache.
Wonderful Geo Page Cache keeps a separate copy per visitor country, looked up from the GeoLite2-Country database WooCommerce already maintains, and per value of the cookies you name. A visitor from Germany gets the copy rendered for Germany, a visitor from Austria the one for Austria — and bots and scanners, who hit the same pages over and over, cost about a millisecond instead of a full WordPress render.
What makes it different
- One copy per country — no country lookup in JavaScript, no flash of wrong prices, no “geolocate with page caching” URL parameters.
- Cookies that vary the page — name the cookies your site uses for a chosen country or language; each value gets its own copy.
- A country the visitor chose — when your site keeps a chosen delivery country in a cookie, name it as the country cookie: a visitor who picked Austria shares the copy of visitors from Austria instead of getting one of their own.
- Cookies that count only when set — a “first visit” marker your site only checks for gives one copy with and one without it, whatever its value.
- Cookies that may be replayed — a “first visit” cookie the site sets identically for everyone is stored with the page and sent again, so first visits are cached too. A response that sets any other cookie is never stored.
- Redirects are cached — a language or country redirect for first-time visitors is stored like a page.
- Safe against cache poisoning — requests whose client address is ambiguous (several forwarded addresses) are not cached, so a page rendered for one country cannot be stored for another.
- Pages stay cached until something changes — the security tokens (nonces) WordPress puts into a page are taken out when it is stored and computed afresh every time it is served, so a cached page never carries an expired token.
- Prewarm — after the cache was emptied, the plugin requests again the pages and variants visitors used in the last 30 days and every other public page, in every language of WPML or Polylang, so visitors rarely meet a page that has to be rendered first. What people use decides what is warmed; crawlers do not.
How it works
- An advanced-cache.php drop-in answers cached requests before WordPress loads.
- Pages are captured with the template output buffer of WordPress 6.9 and later.
- Visitors with a login, cart or session cookie, POST requests, URLs with unknown parameters, cart, checkout and account pages are never cached.
- Visitors with a cart can be allowed to read the cache: move the WooCommerce cart cookies to “Cookies that only read the cache” and they get cached pages, while pages rendered for them are never stored. Use it only when your mini cart refreshes after the page has loaded (WooCommerce cart fragments).
- The whole cache is emptied when content, menus, widgets, stock, scheduled sales, tax rates or plugins change, and through “Empty page cache” in the toolbar menu “Geo Page Cache”. Otherwise pages stay until a lifetime you set, or for good with lifetime 0.
- Nonces are renewed with the keys from wp-config.php. Every nonce is checked against WordPress when a page is stored; if one cannot be rebuilt — or the page contains a nonce WordPress did not report — that page keeps its nonces and expires after 12 hours.