On your site

Page caching on a translated WordPress website

How page caching works with translated URLs, and what happens when you change a translation.

Why there is nothing to configure

Each language has its own URL, so your page cache stores each version separately. You need no Vary header, cookie-aware caching or cache-key rules. A CDN works the same way.

Separate URLs keep cached language versions apart. WPGlotty’s cache integrations only clear old pages when a translation changes. They play no part in which language a visitor sees.

Clearing after a change

When you change a translation, the cached page still contains the old text. WPGlotty clears that page from supported caches, or the whole cache if that is the only option.

  • WP Rocket, W3 Total Cache, WP Super Cache, LiteSpeed Cache
  • Cache Enabler, Nginx Helper, SiteGround, WP Fastest Cache
  • Breeze, Hummingbird, Kinsta, WP Engine, the official Cloudflare plugin

If your cache is not recognised

If WPGlotty finds no supported cache, a notice confirms that your translation was saved but asks you to clear the cache yourself. The notice appears again when this next happens, not on every screen.

Advanced: connecting a server cache

Server-level caches, such as nginx FastCGI, Varnish or a host’s cache, usually have no PHP function that clears them. Use these two filters to connect yours.

add_filter( 'wpglotty_purge_all_handled', function () {
    my_host_purge_everything();
    return true; // tells WPGlotty it was handled
} );

add_filter( 'wpglotty_purge_url_handled', function ( $handled, $url ) {
    my_host_purge( $url );
    return true;
}, 10, 2 );