
— Here is the complete article in pure HTML format: —
How to Set Up Cloudflare Caching Rules for WordPress (2026 Step-by-Step Guide)
If you run a WordPress website, speed matters. A slow site loses visitors and hurts your Google ranking. Cloudflare caching rules for WordPress help your pages load faster by storing copies of your content on servers around the world. When visitors come to your site, they get that cached copy instead of waiting for your server to build the page from scratch.
In 2026, Cloudflare moved away from the old Page Rules system. The new method uses Cache Rules, which are more powerful and easier to manage. This guide walks you through everything you need to set up Cloudflare caching rules for WordPress, step by step. Whether you run a small blog, an online store, or a business site, you will find the right setup here.
Quick Picks – Top 3 Cloudflare Caching Strategies for WordPress
Not sure where to start? Here are three proven strategies for different types of WordPress sites.
1. Best Free Option: The 3-Rule Cache Strategy
This method uses three Cloudflare caching rules for WordPress on the free plan. You bypass cache for admin pages, cache static files like images and CSS with long time-to-live (TTL) values, and force-cache HTML pages for anonymous visitors. It costs nothing and works well for most small sites.
2. Best for Bloggers: Automatic Platform Optimization (APO)
Cloudflare APO caches your entire WordPress site at the edge, including HTML pages. It costs $5 per month and reduces TTFB (Time to First Byte) dramatically. Bloggers with mostly static content and few logged-in users benefit the most from APO.
3. Best for eCommerce: Selective Bypass With Cache Reserve
WooCommerce sites need careful handling. Cart pages, checkout pages, and my-account pages must never be cached. You set up bypass rules for these paths while caching everything else. Cache Reserve keeps large media files available at all edge locations, which helps stores with lots of product images.
What to Know About Cloudflare Caching for WordPress in 2026
Before you create any rules, let us cover the key concepts you need to understand.
Free Plan vs Pro vs APO: Which Option Fits Small Sites?
| Feature | Free Plan | Pro ($20/mo) | APO ($5/mo) |
|---|---|---|---|
| Cache Rules | Yes (up to 5 free rules) | Yes (up to 5 free + unlimited paid) | Yes (includes APO-specific caching) |
| HTML Caching at Edge | Via “Cache Everything” rule | Via “Cache Everything” rule | Automatic for all pages |
| Cache Reserve | No | Add-on ($1/mo) | Yes |
| Best For | Simple blogs | Growing sites with media | Content-heavy global sites |
Most small WordPress sites do fine with APO at just $5 per month. It is the easiest path to fast HTML delivery without tweaking Cache Rules manually.
Page Rules vs Cache Rules: Why Migration Is Now Required
Cloudflare deprecated Page Rules for WordPress caching starting in mid-2024. Page Rules only matched URL patterns. Cache Rules match on URLs, cookies, headers, and file types. This gives you far more control. If you still have old Page Rules, move them to Cache Rules now. The Cloudflare WordPress plugin handles this migration for you automatically.
Edge TTL vs Browser TTL: How These Control Your Site Speed
Edge TTL sets how long Cloudflare servers keep a cached copy. A longer Edge TTL means fewer requests hit your origin server.
Browser TTL sets how long a visitor’s browser keeps a local copy. A longer Browser TTL means returning visitors load pages from their own device, not from Cloudflare.
For WordPress static assets like images and CSS, set both TTLs long (30 days or more). For HTML, use a shorter Edge TTL (like 30 days with APO) and a shorter Browser TTL (like 4 hours) to balance freshness and speed.
Step-by-Step Setup for Cloudflare Caching Rules on WordPress
Now let us get into the hands-on part. Follow these steps to set up Cloudflare caching rules for WordPress correctly.
Prerequisites and 2026 Dashboard Navigation
Before you begin, make sure you have:
- A WordPress site with Cloudflare DNS already active (nameservers pointed to Cloudflare)
- A free Cloudflare account (or paid plan if you need APO)
- The Cloudflare WordPress plugin installed on your site (version 4.7.11 or newer)
Navigate to your Cloudflare dashboard. Select your domain. In the left sidebar, click Rules, then click Cache Rules. This is where you will create all your rules in 2026. The old Page Rules section still exists but should not be used for new WordPress setups.
Why Rule Priority Order Matters (Critical Warning)
Cloudflare evaluates Cache Rules from top to bottom. The first matching rule wins. If you put a broad “cache everything” rule at the top, your bypass rules for admin pages may never fire. This is the most common mistake people make with Cloudflare caching rules for WordPress.
Always place your most specific rules first and your broadest rules last.
Rule 1: Bypass Cache for WordPress Admin and Login Paths
This rule stops Cloudflare from caching any admin or login page. It must sit at the top of your rule list.
- In the Cloudflare dashboard, go to Rules → Cache Rules → Create rule.
- Give the rule a name: Bypass Admin and Login.
- Under Field, select URI Path. Under Operator, select contains. Enter value: /wp-admin.
- Click Or to add another condition.
- Select URI Path, operator contains, value: /wp-login.php.
- Under Cache eligible action, select Bypass cache.
- Click Deploy.
This rule ensures logged-in users and editors always see fresh content, never a stale cached page.
Rule 2: Cache Static Assets (CSS, JS, Images) With Long TTLs
This rule caches files that rarely change. Place it below Rule 1.
- Click Create rule. Name it: Cache Static Assets.
- Set Field to URI Path, Operator to matches, and enter the expression: ends with .css, .js, .png, .jpg, .jpeg, .gif, .webp, .svg, .woff2, .ico.
- Alternatively, use the File extension field if available in your dashboard version.
- Under Eligibility, select Cache eligible.
- Set Edge TTL to 1 month.
- Set Browser TTL to 1 month.
- Enable Browser Cache TTL respects Cache-Control headers if offered.
- Click Deploy.
Rule 3: Force Cache HTML Pages Using Cache Everything
This rule caches full HTML pages for visitors who are not logged in. It goes at the bottom of your rule list.
- Click Create rule. Name it: Cache HTML for Anonymous Visitors.
- Set Field to Cookie, Operator to does not contain, value: wordpress_logged_in.
- Add And condition: URI Path, does not contain, value: wp-admin.
- Under Eligibility, select Cache eligible and check Cache Everything.
- Set Edge TTL to 4 hours (adjust based on how often you update content).
- Set Stale Content to Revalidate so stale content is served while a fresh copy loads in the background.
- Click Deploy.
These three Cloudflare caching rules for WordPress cover the core needs of most small sites. Place them in the exact order shown above.
Cloudflare APO vs Cache Everything for WordPress Sites
If you use only the free plan, Rule 3 above (“Cache Everything”) is your best option for HTML caching. However, APO offers advantages worth considering.
When APO ($5/mo) Outperforms the Free Plan
APO caches the full HTML of your WordPress pages at every Cloudflare edge server worldwide. With the free “Cache Everything” method, caching depends on your custom rules and may not work as smoothly. APO also invalidates cache within 30 seconds when you publish new content, which keeps visitors seeing fresh posts without manual cache purges.
How to Enable APO in the 2026 Cloudflare Dashboard
- Go to your Cloudflare dashboard and select your domain.
- Click Speed → Optimization, then scroll to Automatic Platform Optimization (APO).
- Toggle APO to On. Confirm the $5/month upgrade.
- Open the Cloudflare WordPress plugin on your site. Go to its settings tab and confirm APO is activated.
- In the plugin, enable Automatic cache purge on content updates.
With APO active, you no longer need Rule 3 from above. APO replaces it. Keep Rules 1 and 2 for admin bypass and static asset caching.
Cache Reserve and Smart Tiered Cache Benefits
Cloudflare Cache Reserve stores your files in a persistent data store. Unlike the standard edge cache, which may drop files when they go stale, Cache Reserve keeps them available everywhere. For WordPress sites with many images or downloadable files, this reduces cold-start cache misses to near zero.
Avoiding Common Stale Content and Cart Errors
When using APO or “Cache Everything,” always exclude WooCommerce pages from caching. Cart, checkout, and my-account pages contain personal data and must bypass cache. If you forget this step, shoppers may see products in their cart that belong to another user — a serious bug.
WordPress Plugin Integration: Prevent Double-Caching Conflicts
Running Cloudflare alongside a WordPress caching plugin often causes conflicts. Here is how to set them up properly.
WP Rocket Cloudflare Setup (2026 Recommended Settings)
- In WP Rocket, go to the Add-ons tab and activate the Cloudflare add-on.
- Enter your Cloudflare API token (generate one with Edit zone permissions in Cloudflare).
- Turn on Purge Cloudflare cache on content update.
- Under WP Rocket’s File Optimization tab, keep CSS/JS minification on. Let WP Rocket handle file optimization; let Cloudflare handle delivery.
- Disable page-level caching in WP Rocket if you also use APO, since APO already caches HTML at the edge.
W3 Total Cache and LiteSpeed Cache Integration Tips
Both W3 Total Cache and LiteSpeed Cache have Cloudflare integration panels. Enter your API credentials and enable Automatic cache purge. Disable object caching for pages that Cloudflare already caches. This prevents the same content from being stored twice, which wastes memory and slows down your server.
Auto-Purge Cloudflare Cache When Publishing New Posts
The Cloudflare WordPress plugin supports automatic purging. After connecting your API key, go to the plugin’s Config tab and enable Automatically purge cache on post/page/custom post type changes. This ensures visitors never see an outdated article.
How to Verify Your Cloudflare Caching Rules Are Working
You set up your Cloudflare caching rules for WordPress, but how do you know they actually work? Let us check.
Reading Cf-Cache-Status Headers in Chrome DevTools
- Open your WordPress page in Google Chrome.
- Right-click anywhere and select Inspect.
- Click the Network tab.
- Reload the page (Ctrl+R).
- Click the first request (your page URL).
- Look for the response header cf-cache-status.
HIT vs MISS vs BYPASS vs EXPIRED Explained
| Status | Meaning |
|---|---|
| HIT | Cloudflare served the page from cache. Fast result. |
| MISS | No cached copy found. Cloudflare fetched it from your server. First visit or expired cache. |
| BYPASS | Cache skipped by design. Expected for admin and login pages. |
| EXPIRED | Cache existed but was too old. Cloudflare will refresh it and serve the old copy while loading the new one. |
A public homepage should show MISS on first load and HIT on every reload after that. Admin pages should always show BYPASS.
Benchmarking TTFB and LCP Before and After Setup
Use Google PageSpeed Insights or webpagetest.org to measure your site speed before and after applying Cloudflare caching rules for WordPress. Watch for two key metrics: TTFB (how fast the first byte arrives) and LCP (how fast the largest content element loads). After setup, TTFB should drop below 200ms for most global visitors.
Troubleshooting Common Cloudflare WordPress Caching Issues
Things can go wrong. Here are the most common problems and how to fix them.
Fixing Admin Lockout and Login Loop Problems
If you cannot log in to WordPress or the login page keeps refreshing, your bypass rule likely has an error. Check that Rule 1 matches /wp-admin and /wp-login.php. Temporarily disable all Cache Rules to confirm the issue is cache-related. Fix the rule and re-deploy.
Solving Stale Content After Publishing Updates
If new posts do not appear on your site after publishing, purge the cache. In the Cloudflare dashboard, go to Caching → Configuration → Purge Everything. Better yet, use the Cloudflare WordPress plugin’s auto-purge feature so this happens automatically each time you publish.
Resolving WooCommerce Cart and Checkout Errors
If shoppers see wrong cart contents or checkout fails, your bypass rules missed the WooCommerce pages. Add explicit bypass rules for /cart, /checkout, and /my-account. If you used APO, verify the WooCommerce section in the plugin settings shows Enable for dynamic page bypass.
Debugging Rules That Won’t Apply (Expression and Priority Errors)
If your Cache Rule shows as “Inactive” or produces no effect, check two things. First, rule priority: the first matching rule wins, so move specific rules above broad ones. Second, check your expression syntax. Cloudflare shows a green checkmark for valid expressions. Red means a syntax error — usually a missing quote or wrong operator.
FAQ: Common Questions About Cloudflare Caching Rules for WordPress
Are Page Rules Dead in 2026?
Yes, for WordPress caching. Cloudflare still lets you edit existing Page Rules, but new WordPress setups must use Cache Rules. The official Cloudflare WordPress plugin no longer generates Page Rules since version 4.7.11.
What TTL Settings Work Best for Small WordPress Sites?
For static assets (CSS, JS, images): set Edge TTL and Browser TTL to 30 days or more. For HTML pages: use 4 hours with the free plan, or let APO manage the 30-day TTL with its built-in 30-second invalidation. This keeps pages fresh while saving server load.
Can I Use WP Rocket and Cloudflare APO Together?
Yes, but configure them carefully. Let WP Rocket handle file minification, concatenation, and deferred JS loading. Let APO handle HTML page caching at the edge. Disable WP Rocket’s own page cache to avoid double-caching. The two plugins work best as a team rather than as competitors.
Why Isn’t Cloudflare Caching My WordPress Images?
Check three things. First, your images must be served from the same domain that passes through Cloudflare. Images hosted on external services (like a third-party CDN) will not be cached. Second, ensure your Rule 2 expression matches your image extensions correctly. Third, check your Cache-Control headers — some WordPress plugins send headers that prevent caching. Look for no-cache or private directives.
Final Recommendations for WordPress Caching in 2026
Setting up Cloudflare caching rules for WordPress does not have to be hard. Start with the three free rules: bypass admin, cache static assets, and cache HTML for anonymous visitors. Test with Chrome DevTools to confirm everything works. If your site grows or serves readers worldwide, upgrade to APO for $5 per month — it handles HTML caching better than any manual rule.
Keep your WordPress caching plugin and Cloudflare plugin in sync. Always exclude WooCommerce dynamic pages. Purge cache after publishing new content. Check your cf-cache-status header regularly.
With these Cloudflare caching rules for WordPress in place, your site will load faster, rank higher, and keep visitors happy. Small changes in caching configuration can lead to big wins in speed and user experience.
