Age Verification Popup and Page Cache: Fix It for WP Rocket, LiteSpeed and Cloudflare
Page caching is the most common reason an age verification popup shows on every page, never shows, or loops. Here is why it happens with WP Rocket, LiteSpeed Cache and Cloudflare, and how to set up an age gate that works with full-page caching.
Short answer: if your age verification popup shows on every page, never shows, or keeps coming back after visitors pass it, your page cache is almost always the cause. The fix is an age gate that checks the verification cookie in the browser, plus one cache clear after you change settings.
Caching plugins like WP Rocket, LiteSpeed Cache, W3 Total Cache and CDNs like Cloudflare save a finished copy of each page and serve it to every visitor. That is what makes WordPress fast. It also means anything that is different per visitor, like “has this person verified their age?”, cannot be decided on the server once the page is cached.
The three symptoms
| Symptom | What happened |
|---|---|
| Popup shows on every page, even after verifying | The cache saved a copy with the gate in it and serves it to everyone. |
| Popup never shows | The cache saved a copy without the gate, often from a logged-in admin or a visitor who already verified. |
| Popup works on some pages, not others | Some pages were cached before you installed or changed the gate, others after. |
Why server-side age gates break with caching
Many age verification plugins read the cookie in PHP and decide there whether to print the popup. The first visitor to a page creates the cached copy, and every visitor after that gets the same decision, whether they verified or not. Some plugins try to fix this by turning off caching on every gated page, which makes the site slow for everyone.
The cache-safe approach: decide in the browser
A cache-friendly gate puts the same small script on every cached page. When the page loads, the script checks the age_verified cookie in the visitor’s browser and shows the popup only if it is missing. The cached HTML is identical for everyone, and the decision is still personal.
This is how Advanced Age Verification Pro works. WP Rocket, LiteSpeed Cache, W3 Total Cache, Cloudflare and server caching keep caching your pages as normal.
Setup checklist
- Use a browser-side gate. Advanced Age Verification Pro does this by default.
- Turn off test mode, then clear your page cache once. Test mode shows the gate only to administrators, so pages cached during setup may not include the live gate.
- Clear the cache again after you change the popup design or text.
- Do not combine JavaScript files aggressively if the popup stops loading. In WP Rocket or LiteSpeed, exclude the age verification script from “combine” or “delay JavaScript” if needed.
- Test in a private window, not as a logged-in admin, because logged-in users can skip the gate.
WP Rocket
- Clear the cache in WP Rocket → Dashboard → Clear cache after going live.
- If you use Delay JavaScript execution and the popup appears late, add the age verification script to the excluded list.
- You do not need to add the
age_verifiedcookie to “Never cache cookies” with a browser-side gate.
LiteSpeed Cache
- Purge all in LiteSpeed Cache → Toolbox after going live.
- If you use JS Delayed or Guest mode, exclude the age verification script if the popup does not appear for first-time visitors.
- If you renamed the cookie in the plugin, you can add it to LiteSpeed’s vary cookies, but a browser-side gate does not need it.
Cloudflare
- Purge the cache in Caching → Configuration → Purge Everything.
- Rocket Loader can change the order scripts run. If the popup flickers, exclude the script or turn Rocket Loader off.
- Full-page edge caching (APO or “Cache Everything”) works with a browser-side gate, because the check happens after the page loads.
What about visitor-specific rules?
Some features truly depend on who the visitor is: different rules per country, schedules, A/B tests or strict server-side hiding of content. Advanced Age Verification Pro marks only those pages as not cacheable, automatically, and keeps everything else cached. You can also change the cookie name and path in Age Verification → Advanced & Tools if your cache setup needs a specific prefix.
Speed and SEO
A browser-side gate keeps your pages cached and fast, which helps Core Web Vitals. Real Google and Bing crawlers are recognised by their IP address and skip the gate, so your pages stay indexed. For more on rankings, read Does an Age Verification Popup Hurt SEO? and the SEO, cookies and advanced rules guide.
Still seeing a problem?
Check the troubleshooting guide or contact us with your caching plugin name and the page URL. Want the cache-safe gate on your site? Get Advanced Age Verification Pro or start with the free version on WordPress.org.
Frequently asked questions
Why does my age verification popup show on every page?
Usually the plugin decides on the server whether to show the gate, and your cache saved the page with the gate already in it. Every visitor then gets that cached copy. A gate that checks the cookie in the browser avoids this.
Why does my age verification popup not show at all?
The cache saved a copy of the page from a visitor (often you, logged in) who did not see the gate. Clear the page cache after changing settings or leaving test mode, and make sure the gate runs in the browser.
Do I need to exclude my age-restricted pages from the cache?
Not with a cache-friendly gate. Advanced Age Verification Pro checks the cookie in the browser, so WP Rocket, LiteSpeed Cache and Cloudflare keep caching. Pages that depend on the visitor, such as region rules or strict gating, are marked as not cacheable automatically.
Does Cloudflare APO or edge caching break age gates?
It breaks gates that are decided on the server. A browser-side gate works the same on a cached copy, because the check happens after the page loads.