Fix PageSpeed’s “Efficient Cache Lifetimes” on a WordPress Beat Store
PageSpeed Insights keeps nagging about Use efficient cache lifetimes. On a beat store that usually means your CSS, JS, cover art, and fonts are only cached for a few hours — or not at all — so return visitors download them again.
This is the setup we recommend for BeatStore UI Theme sites. We are applying the same rules on firebeats.shop so the advice matches a live store, not a brochure demo.
What Google is measuring
For cacheable static files (CSS, JavaScript, fonts, images, media), the browser should be told to keep them for at least 30 days. A year is better when the URL changes whenever the file changes.
A request counts as cacheable when:
- It is a font, image, media file, script, or stylesheet
- The response is
200/203/206 - Headers do not forbid caching (
no-store,no-cache, and friends)
HTML pages, cart, checkout, and logged-in views are a different story. Those should stay short-lived or uncached.
What the theme already does
UI Theme versions its own CSS and JS with the file’s modification time (?ver=…). When you update the theme, the URL changes, so a long browser cache is safe.
That part is out of the box. The cache lifetime header is not. Static files under /wp-content/ are served by your web server or CDN. They never run through theme PHP, so the theme cannot promise those headers on every host.
If you only update the theme and leave Cloudflare (or your host) on a 4-hour default, PageSpeed will keep complaining. That is what firebeats was doing: theme assets were versioned, but Cloudflare sent Cache-Control: max-age=14400.
The policy we recommend
| Asset | Browser cache |
|---|---|
| Theme / plugin CSS & JS (versioned URLs) | 1 year: public, max-age=31536000, immutable |
| Fonts, cover art, uploads, preview audio | Same, or at least 30 days |
| HTML, cart, checkout, account | Short TTL or no-store |
Do not put a year-long cache on HTML that contains cart nonces or checkout forms. BeatStore’s player docs already warn that a page cache longer than ~12 hours can break preview protection nonces — keep page cache and browser cache for documents conservative.
Fix it on Cloudflare (most common)
If the site sits behind Cloudflare (firebeats does):
- Open Caching → Cache Rules (or Configuration Rules, depending on your plan)
- Match URI Path starts with
/wp-content/(add/wp-includes/if you want core assets too) - Set Browser Cache TTL to 1 year
Or set origin headers first, then use Respect Existing Headers - Optionally raise Edge Cache TTL so Cloudflare keeps a copy at the edge
- Purge cache once, hard-refresh, and check a CSS URL in DevTools → Network → Response Headers
You want something like:
cache-control: public, max-age=31536000, immutable
Re-run PageSpeed Insights. First-party theme and upload URLs should drop off the “efficient cache lifetimes” list. Third-party scripts (Google Analytics, tag managers) keep their own TTLs — that is normal and outside your theme.
Fix it at the origin (no CDN, or CDN respects origin)
Apache / LiteSpeed (.htaccess)
<IfModule mod_headers.c>
<FilesMatch "\.(css|js|woff2?|ttf|otf|eot|png|jpe?g|gif|webp|avif|svg|mp3|wav|m4a)$">
Header set Cache-Control "public, max-age=31536000, immutable"
</FilesMatch>
</IfModule>
Nginx
location ~* \.(css|js|woff2?|ttf|otf|eot|png|jpe?g|gif|webp|avif|svg|mp3|wav|m4a)$ {
add_header Cache-Control "public, max-age=31536000, immutable";
access_log off;
}
Managed hosts sometimes ignore both. On Cloudways (what we recommend for production beat stores), use their stack / Varnish settings for page cache, and still set browser TTL on Cloudflare or in the nginx vhost if you control it.
Render-blocking requests (the other common ding)
PageSpeed may also list several CSS/JS files ahead of first paint. On a UI Theme homepage we trim what we can in the theme and Contracts:
- Theme
style.cssfolds into the main stylesheet (one fewer request) - EDD’s default front CSS loads on checkout / receipt pages, not every catalog view
- Contracts “View license” CSS waits until the cart has something to preview
jquery-migratestays off on the front end; core jQuery remains for EDD
jQuery itself often still shows up — EDD and many WordPress plugins expect it. Host/CDN cache headers and image weight usually buy more score than trying to delete jQuery.
How this relates to a “fast theme” claim
Browser cache lifetime helps return visits. It barely moves a cold first load. A strong mobile score also needs:
- Reasonable cover-art sizes (WebP/AVIF help)
- A host with low TTFB for HTML
- Restraint on page builders, sliders, and heavy analytics
- No accidental double cart stacks or duplicate libraries
So we do not slap a hard “guaranteed 80+ PageSpeed” sticker on the theme license. Lab scores swing with your catalog images, plugins, CDN, and third parties. What we will stand behind:
- UI Theme ships versioned static assets so a 1-year cache is safe
- On a sane stack (Cloudways-class host + Cloudflare browser TTL + compressed media), a clean homepage should land in a solid 80+ mobile lab range once cache headers are fixed — that is the bar we are proving on firebeats, not a warranty for every plugin combo
- Cart, checkout, and nonce-backed player pages stay off the “cache forever” list
If you want the storefront itself, start with BeatStore UI Theme. If you need the host half of the recipe, see Choosing the right WordPress host.
Quick checklist
- Confirm theme CSS/JS URLs include
?ver=(UI Theme does this) - Set browser TTL ≥ 30 days (prefer 1 year) for
/wp-content/static files - Leave HTML / cart / checkout short-lived
- Compress cover art before you chase another five PSI points
- Re-test mobile + desktop after a cache purge
That is the efficient-cache fix. The rest of the score is media weight and hosting — same as any real beat shop.