If your WordPress site feels slow even though the server still has headroom, the fix often sits in front of the server, not on it. A plan to speed up WordPress Cloudflare APO caching does exactly that: Cloudflare serves cached HTML from its edge network, so many visitors never touch your origin server at all. This guide walks through the full setup: turn on Automatic Platform Optimization (APO), add Page Rules for the parts of WordPress that must never cache, and test the result so you know the speed gain is real.
Speed Up WordPress Cloudflare APO: What Gets Cached
Without APO, Cloudflare caches static files such as images, CSS, and JavaScript by default, but it passes each HTML page request through to your origin. With APO on, Cloudflare also caches the HTML of pages for logged-out visitors. That matters because HTML is usually the slowest part of a WordPress request: PHP has to run, the database has to answer, and the page has to be built before the first byte leaves the server. A cached HTML response skips all of that. Logged-in users still get fresh pages, so the admin bar, the editor, and preview links keep working as normal.
APO is a WordPress-specific feature, and it works best on a standard WordPress install with a normal theme. If your site serves a different page to every visitor, for example a membership site where the homepage changes per user, edge HTML caching will cause more trouble than it saves. For a typical blog, business site, or brochure site, it is a good fit. Check the current plan page on Cloudflare before you commit: APO availability and limits change over time, and the official pricing page is the only source worth trusting for what your plan includes.
Before You Turn APO On
Sort the origin first. Edge caching hides a slow origin, it does not fix one, and any page that misses the cache still pays the full origin cost. If your origin still runs slow, fix that before you add APO: our guide to installing WordPress on a LEMP stack with Nginx, PHP, and MariaDB gives you a clean, fast baseline to cache in front of. Also turn off any other full-page caching plugin before you enable APO. Two systems writing and purging the same cache will fight, and the symptom is stale pages that refuse to update no matter how often you purge.
Take a backup before you change anything, and note your current load time with a tool like PageSpeed Insights so you have a before number to compare against. If your site runs WooCommerce or another shop plugin, list the pages that must stay dynamic now: cart, checkout, account pages, and any page that shows a per-user price or stock level. You will bypass those with rules below.
Cloudflare APO WordPress Setup, Step by Step
Work through these steps in order. Skipping the plugin step is the most common mistake: APO needs the official Cloudflare plugin on your WordPress site to purge the right URLs when content changes.
- Add your domain to Cloudflare and point your nameservers at Cloudflare. Wait until the dashboard shows the zone status as Active.
- In WordPress, install the official Cloudflare plugin from the plugin directory. Open its settings and connect it with an API token, not your Global API Key. Give the token cache purge and zone settings permissions for this zone only.
- In the Cloudflare dashboard, go to Speed, then Optimization, then Automatic Platform Optimization, and turn APO on.
- Decide on Cache by Device Type. Turn it on only if your theme serves different HTML to phones and desktops. If your theme is responsive and serves the same HTML everywhere, leave it off so the cache stays simple.
- Purge everything once from Caching, then Purge Everything, so the edge starts from a clean slate.
- Open the homepage in a private browser window while logged out. Check that the page loads and that no logged-in content leaks into it.
The plugin handles most purges after this point: publish a post, and the plugin tells Cloudflare to drop the cached copies of the homepage, the post, and related archive pages. You still purge by hand after theme changes, plugin updates, and menu edits, because those can touch pages the plugin does not know about. Cloudflare documents the full behavior in its Automatic Platform Optimization guide.
WordPress Page Rules Cache Setup for APO
Page Rules tell Cloudflare how to treat specific URLs. They run in order from top to bottom, and the first matching rule wins, so put your bypass rules above any broad caching rule. Replace example.com with your own domain in each pattern. Check how many rules your plan allows before you plan around them, since the limit differs by plan.
| URL pattern | Setting | Why it matters |
|---|---|---|
| *example.com/wp-* | Cache Level: Bypass | Keeps wp-admin, wp-login.php, and the editor out of the cache so staff always see live pages. |
| *example.com/*preview=true* | Cache Level: Bypass | Stops draft previews from caching and from leaking into public results. |
| *example.com/cart/* | Cache Level: Bypass | Cart pages are per-visitor and must never serve one shopper’s cart to another. |
| *example.com/checkout/* | Cache Level: Bypass | Checkout pages carry payment and address data and must stay fully dynamic. |
Add these in the dashboard under Rules, then Page Rules. After saving, test each pattern: open wp-admin in a private window and confirm you reach the login screen, and open the cart page and confirm it loads fresh. A bypass rule that does not match because of a missing asterisk is a common cause of cached admin pages, so test rather than assume.
Cloudflare Cache Rules WordPress: The Newer Option
Page Rules are the older system, and Cloudflare now steers new setups toward Cache Rules, which live under Rules, then Cache Rules. A Cache Rule can set Cache Everything for your HTML paths and bypass the same admin, preview, cart, and checkout paths with a single expression each. If you are starting fresh, build your rules as Cache Rules and keep Page Rules only for settings that Cache Rules do not cover. If your site already runs well on Page Rules, there is no rush to rebuild: both systems work today, and a working setup beats a fashionable one.
One warning applies to both systems: never cache a URL that sets a session cookie or shows personal data. If you are unsure whether a page is personal, bypass it. A slow dynamic page is a small cost; serving one visitor’s private page to another is a serious one.
What APO Does Not Protect
APO speeds up delivery, it does not lock down access. Anyone can still request wp-login.php directly, and bots can still probe it. If you want to put wp-admin behind an identity check, read our take on whether Cloudflare Zero Trust is worth using for self-hosted apps before you add that layer. And if your origin sits behind a tunnel or a proxy manager rather than direct DNS, the setup order changes: our comparison of Cloudflare Tunnel versus Nginx Proxy Manager versus Traefik explains which path fits which kind of server.
Test, Purge, and Keep It Honest
After every change, purge and retest. Run this check from your terminal to see the cache status of a page:
- Run
curl -sI https://example.com/ | grep -i cf-cache-statustwice. The first run may show MISS while the edge fills; the second run should show HIT. - Load the homepage in a private window, logged out, and confirm the content matches the live post, not an older version.
- Re-run PageSpeed Insights and compare against your before number, using the same test location and connection where possible.
- Publish a test change, then check the public page within a minute. If the old version lingers, purge that URL by hand and check the plugin connection.
If a page shows stale content after a purge, check three things in order: the plugin is still connected with a valid token, no second caching plugin is serving its own copy, and your Page Rules do not cache a URL that should bypass. Most APO problems trace back to one of those three. Once the setup passes these checks, leave it alone: constant tinkering with cache settings causes more downtime than any single setting ever saves.