Page Caching


A page cache keeps a finished copy of each page and hands it to the next visitor without asking WordPress again. WP Rocket, LiteSpeed Cache, W3 Total Cache, WP Super Cache and your host’s server cache all work this way, and a CDN such as Cloudflare can do the same from its own servers. That’s great for speed and bad for a speedway score that changes every four minutes. This page explains how Speedway Leagues keeps live pages current behind a cache, which cached pages it clears for you, which ones you clear yourself, and what to check when scores stop moving.

The short version: live match pages and live rows in match lists update in the visitor’s browser, so they work behind any page cache. The plugin also clears (“purges”) the cached match, team and competition pages when a match starts, finishes or changes status, and when its line-up changes before the meeting. Settings and edits to teams, riders and the standings inputs don’t clear anything, so clear the cache yourself after those.

🎯 How live pages stay current

The HTML of a match page can be minutes old and the score still moves. A small script on the page asks your site for the latest state and swaps in what changed. It asks through two public addresses on your site’s REST API – the part of WordPress that answers in data rather than pages, under /wp-json/:

AddressUsed byWindow
/wp-json/anwpsw/v1/live/{match}/{t}A match page (and the Match protocol shortcode and block): the header, the heat cards and the Riders tables10 seconds
/wp-json/anwpsw/v1/live/list/{t}Schedule rows on competition and team pages, and in the Fixtures and results, Next match and Last result shortcodes and blocks. One address for the whole site30 seconds

The {t} at the end is the start of the current window as a Unix timestamp (seconds since 1970). Everyone watching in the same 10 seconds asks for exactly the same address, and the answer says how long it may be kept: Cache-Control: public, max-age=10 (30 for the list). Cache-Control is the header that tells browsers and caches how long a copy stays good. The next window is a new address, so no cache can hand out an old score under it. That also means a cache that keeps an answer longer than it should does no harm – nobody asks for that address again.

Two more things make these checks cache-friendly:

  • No cookies. The script sends its requests without cookies, so every visitor gets the same answer, and a cache’s “logged-in users bypass the cache” rule never kicks in. The answers never depend on who’s asking.
  • A short range. The site answers only a window that started at most two window lengths ago or starts within the next one – the current window and its neighbours. Anything else – an old timestamp, a made-up one, a match that isn’t public – gets the same plain 404 (Not found.). So nobody can flood your server with addresses a cache has never seen.

How often a page checks

Page or rowChecks
Match page, scheduledOnce when it opens, then every minute from 30 minutes before the kickoff
Match page, liveEvery 10 seconds, until the match is finished or abandoned
Match page, finished, abandoned, postponed or cancelledNever
Schedule row, scheduledEvery minute, from 15 minutes before its kickoff to 24 hours after it
Schedule row, liveEvery 30 seconds, until the match is finished, abandoned, postponed or cancelled
A page with no row live or near its kickoffNo checks until a row is 15 minutes from its kickoff

Checks pause while the browser tab is in the background and run again as soon as it’s back. Because a scheduled or live match page checks once as it opens, even a cached copy from before the kickoff catches up within seconds. What the visitor sees change is on Public Pages.

One thing the script can’t fix: a cached copy of a match page saved while the match was finished, abandoned, postponed or cancelled doesn’t check at all. That’s why the plugin clears the match page whenever its status changes (next section).

What the plugin clears for you

After each of these, the plugin asks your cache plugin to drop the cached copy of the match page, the pages of the teams in it and its competition page:

  • a match starts (Start the meeting, or the first heat saved in the match centre);
  • a match is finished, abandoned or re-opened;
  • you change a match’s status on the match screen – postponed, cancelled, or back to scheduled;
  • before the meeting (a scheduled or postponed match), a line-up is announced, or saved with other riders or numbers, in the match centre – a news post with the Line-ups block is its own page, so clear that one yourself;
  • a heat is corrected on a finished match, or a finished match gets another team, phase or group (the standings change too);
  • one leg of a two-legged tie is deleted permanently – the pages of the other leg are cleared.

Only pages visitors can see are cleared – a draft or password-protected team page is skipped. And it never happens for a live heat: during the meeting the page updates itself, so clearing your cache 15 times a night would only slow the site down.

Which cache plugins hear it

CacheWhat gets cleared
WP Rocket, LiteSpeed Cache, W3 Total Cache, WP Super Cache, WP Fastest Cache, Hummingbird, SpinupWP, WP EngineThe match, team and competition pages, each at its own address
SiteGround Optimizer, FlyingPressThe same pages, plus the season’s own address of the competition (see below)
Breeze, RunCloud, Endurance Page CacheThe whole site (these can’t clear one page), once per event – not once per page
The Cloudflare pluginThe match, team and competition pages, each at its own address (not the season’s), when the Cloudflare plugin’s automatic cache clearing is on
Anything elseNothing, unless a developer connects it (see For developers)

Your cache plugin may clear more than that on its own – some also drop the home page or archives whenever a page is cleared. That’s the cache plugin’s rule, not Speedway Leagues’, so check its settings if you want to know.

Season addresses

A competition page has one address per season: the bare one shows the current season, and /speedway-competition/northern-league/2025/ shows 2025. Most cache plugins clear a page by its post, which means the bare address only. So with WP Rocket, LiteSpeed Cache, W3 Total Cache and the others in the first row, and with the Cloudflare plugin, a season’s own address – every past season, and the current season’s when someone links to it with the year – keeps its cached copy until the cache expires. Say you correct a heat of a 2025 match: the bare competition page is cleared, the /2025/ page waits. Clear that page by hand, or give your cache a lifetime you’re happy with. SiteGround Optimizer, FlyingPress and the whole-site plugins do clear the season’s address.

What you clear yourself

Everything else waits for your cache to expire. Clear the cache (the page, or the whole site) after any of these:

You changePages that keep the old version
Anything under Speedway Leagues > Settings – Texts and Display (birth dates, helmet colours, team circles, heat result letters, Your club)Every cached page with Speedway Leagues content. Clear the whole cache
A URL base under Settings > PermalinksEvery cached page: their links still point at the old addresses, which now return 404. Clear the whole cache
A team, rider, venue or competition (name, logo, colour, photo), or a squadYour cache plugin may clear the edited page itself when you save it – that’s its own rule. The match, competition and other pages that show the name or logo keep the old one
A new match, or a match’s kickoff, venue, round or teams, with its status unchanged (a finished match’s teams, phase or group are the exception, above)The competition and team pages keep the old schedule – a new match isn’t in it yet
The Standings page: adjustments, withdrawals, ballots, tie cards, Rebuild now – or the season’s rulesetThe competition page keeps the old table and classification
A match moved to the Trash or deletedThe competition and team pages keep its row, and a cached copy of the match page itself may stay until it expires
A template copied into your themeEvery cached page that uses it

And pages that hold a shortcode or a block – a home page with a league table, a sidebar with the next match – are never cleared by the plugin, because it can’t know which of your pages carry one (only the whole-site plugins above clear them, as a side effect). Their live rows still correct themselves in the browser, but a table, the rider averages and the choice of the “next” match wait for the cache. Give those pages a short cache lifetime, or clear them after a match day. More on Shortcodes & Blocks.

Check as a visitor

Most page caches skip logged-in users, so you see a fresh page while your visitors get the cached one. Check a change in a private (incognito) window, where you’re logged out.

Settings to check

Every cache plugin names its settings differently, so this list describes what to look for rather than where it is.

Security plugins and “disable REST API” settings

Some security plugins and tweak plugins block the REST API for logged-out visitors. That stops every live update. Allow logged-out requests to /wp-json/anwpsw/v1/ – it only reads public data, and only two addresses live there. Because the checks go without cookies, an “allow logged-in users” exception doesn’t help: to your site even an administrator’s live checks look like a visitor’s.

Don’t open the rest of the plugin’s REST API to caching while you’re there. The match centre and the admin screens use their own address (/wp-json/anwpsw-admin/), which is per user and must never be cached.

JavaScript optimisation

The live checks come from the plugin’s public script, sw-public.min.js, loaded at the end of the page as a deferred script. A short inline script just before it sets up the schedule-row checks. Two optimisation features can break that:

  • Delaying JavaScript until the visitor interacts (a scroll, a tap). Delayed, the script runs – and live updates start – only after the first scroll or tap. Add sw-public.min.js to the feature’s exclusions so they start as the page opens.
  • Combining or moving inline scripts. If the inline setup is dropped, or now runs after the script (once both are combined into one file, say), schedule rows stop updating while match pages keep working. Exclude the inline script that contains _anwpSWPublicLive, or leave inline scripts alone.

Minifying the file or loading it deferred is fine – it’s deferred already.

Cloudflare and other CDNs

By default Cloudflare doesn’t cache anything under /wp-json/ – it treats those answers as dynamic. So every live check reaches your server. With 2,000 people on a live match page that’s about 200 requests a second to WordPress, plus about 67 a second from 2,000 visitors on pages with schedule rows. A small site is fine without a rule. For a busy one, add a Cloudflare Cache Rule:

SettingValue
When the request matchesURI path starts with /wp-json/anwpsw/v1/live/
Cache eligibilityEligible for cache
Edge TTLUse cache-control header if present, bypass cache if not
Browser TTLRespect origin

That one rule covers both addresses. Cloudflare then answers each 10-second window from its own servers, and your site builds it once. Keep the path exactly as above – a rule for all of /wp-json/ would cache the admin answers too. Another CDN works the same way: cache that path, respect the Cache-Control your site sends, don’t vary on cookies.

On a site with plain permalinks (no pretty addresses), the live addresses look like /?rest_route=/anwpsw/v1/live/... and a path rule can’t match them. Switch to any pretty permalink setting first.

If Cloudflare also caches your whole pages, the Cloudflare plugin clears them as in the table above. Without the plugin, Cloudflare keeps pages until their cache lifetime ends.

Host and server caches

SpinupWP’s page cache (with its plugin active) and WP Engine’s are cleared like the plugins above. Other server caches – Varnish or nginx caching set up by your host – aren’t in the list. For those, set a cache lifetime you can live with on match days, ask your host whether they clear pages on request, or have a developer connect them (For developers).

Stadium mode and the match centre

The match centre lives in your WordPress dashboard, which page caches don’t touch. Stadium mode is on your public site, so it takes care of itself: every stadium page – the Results list, a match, the sign-in redirect and the refusal pages – sends no-cache headers, tells cache plugins not to store it, and sends X-Robots-Tag: noindex, nofollow so search engines leave it out. Cache plugins that follow WordPress’s usual “don’t cache this page” signal skip these pages, and most page caches skip logged-in users anyway – which a reporter on a stadium page always is (a logged-out visit only gets the sign-in redirect).

A host or CDN cache that ignores what WordPress asks is the exception. If yours does, exclude both forms of the stadium link from caching:

  • the path /speedway-entry/ (or the Stadium mode base you set under Settings > Permalinks);
  • any address with ?anwpsw_entry= in it.

Otherwise a reporter could get a cached screen with a colleague’s name on it, or a stale sign-in redirect. More on Stadium Mode.

Object cache (Redis, Memcached)

An object cache is a different thing: it stores pieces of data between requests (in Redis or Memcached), not whole pages. Speedway Leagues uses it for its public pages if your site has one, and there’s nothing to set up or flush:

  • Every save that changes public data – a heat, a match, a team, a setting, a standings rebuild – moves the cached data on at once. You never see stale data from the object cache.
  • Every stored entry carries the plugin’s version, so after an update the new version never reads data the old one stored.
  • The list of live matches is built once per 30-second window and shared by every visitor, which takes load off a busy site even without a CDN rule.

Without an object cache everything still works – the plugin just builds each page from the database.

🆘 Troubleshooting

Live scores don’t move

Open the live match page in a private window, open your browser’s developer tools (F12), go to the Network tab and type anwpsw in its filter box. Then:

You seeWhat it means
No live/ request at allThe script didn’t run, or the page doesn’t ask. Check JavaScript delay and combining (above). Check the page itself: a cached copy that says finished, postponed or cancelled doesn’t check – clear it. A template copied into your theme must keep the live attributes (see Template Overrides). And a developer may have switched the live addresses off (For developers)
Requests answered 401 or 403A security plugin or a “disable REST API” setting blocks logged-out visitors. Allow /wp-json/anwpsw/v1/. The page keeps trying, so updates start once it’s allowed
Requests answered 404See 404 on the live address below
Requests answered 200, nothing changesNothing has changed yet, or the match isn’t live: a scheduled page checks once as it opens, then once a minute from 30 minutes before the kickoff

Schedule rows follow the same checks with live/list/ requests. A row is checked only while it’s live, or from 15 minutes before its kickoff to 24 hours after it, so a page with no match that close makes no request – that’s normal. If match pages update but rows don’t, look for an optimisation plugin moving or dropping the inline _anwpSWPublicLive script.

You can also open the list address yourself. In a private window, go to https://example.com/wp-json/anwpsw/v1/live/list/ followed by the current Unix time rounded down to a multiple of 30 (from a terminal: echo $(( $(date +%s) / 30 * 30 ))). A working site answers with a small block of data, even when nothing is live.

With the Cloudflare rule in place, the answer’s cf-cache-status header says MISS on the first request of a window and HIT on a repeat in the same window. DYNAMIC means Cloudflare doesn’t see the address as cacheable – the rule doesn’t match.

404 on the live address

Every refusal is the same 404 on purpose, so it can mean any of these:

  • The match isn’t public. The number isn’t a match, or the match is a draft, private, password-protected or in the Trash, or its competition isn’t published. Publish it – the page script stops after a 404 and starts again on the next page load.
  • The timestamp is outside the range. Only the current window and its neighbours answer, and only a timestamp that’s a whole multiple of the window. Typing an address by hand, round down to a multiple of 10 (match) or 30 (list) and use it straight away. The page script corrects this itself: if the cached page’s clock gives a 404, it tries the device’s clock once. A phone or computer whose clock is more than 10 seconds off can still miss, and one more than 20 seconds off always does (30 and 60 for schedule rows) – set it to the network time.
  • The live addresses are switched off by a developer (For developers). Then every live address is a 404 and pages don’t check at all.

More problems

ProblemFix
A page still shows the old result after FinishCheck in a private window first. If it’s still old: your cache isn’t one the plugin knows (see the table above) – clear the page, or have a developer connect the cache. On a season’s own address (/2026/) or a page with a shortcode or block, that’s expected with most caches: clear that page
The competition table is old after a points deduction or a ballotStandings inputs don’t clear the page cache. Clear the competition page
Changed settings or texts don’t showSettings saves don’t clear the page cache. Clear the whole cache
Links lead to 404 after a permalink changeCached pages still carry the old links. Clear the whole cache, then see the Permalinks page
A reporter’s phone shows another person’s name or an old Results listA host or CDN cache stores stadium pages. Exclude both forms of the stadium link (see Stadium mode and the match centre above)
The server struggles during a live meetingAdd the Cloudflare rule (or the same rule on your CDN), so the live checks are answered from the CDN

For developers

Four filters and one action, for a theme or a small custom plugin:

HookWhat it does
anwpsw/cache/purge_post (action)Fires for every page the plugin clears, with $post_id and $urls (a competition’s season address included). Hook your own cache or CDN purge here
anwpsw/rest/public_accessReturn false to switch both live addresses off. Every request is then a 404 and pages don’t check – they show what they had when they loaded
anwpsw/live/periodThe match page window in seconds (default 10) – also its max-age
anwpsw/live/list_periodThe schedule-row window in seconds (default 30) – also its max-age and how often a live row checks
anwpsw/live/list_windowHow long after kickoff a match stays in the list and a scheduled row keeps checking, in seconds (default 24 hours, at least 1 hour)
add_action( 'anwpsw/cache/purge_post', function ( $post_id, $urls ) {
	foreach ( $urls as $url ) {
		my_host_purge_url( $url ); // Your cache's own purge call.
	}
}, 10, 2 );
  • Public Pages – what a live match page and live schedule rows show.
  • Shortcodes & Blocks – tables and match lists on your own pages.
  • Stadium Mode – the phone link for reporters.
  • Permalinks – the URL bases, the stadium base included.
  • FAQ – short answers to the common questions.