Cloudflare APO for WordPress: how it works

What Cloudflare's Automatic Platform Optimization caches on a WordPress site, what it skips, how to switch it on and check it, and when to leave it off.

IntermediateExplainer8 min readUpdated November 4, 2026

In this guide
  1. What APO is
  2. What it changes for a visitor
  3. What APO caches and what it skips
  4. What you need before you switch it on
  5. How to switch it on
  6. How to check that it works
  7. Living with it
  8. APO and other caching plugins
  9. When APO is the wrong tool
  10. Mistakes to avoid
  11. Check your own page
  12. Sources

What APO is

Most content delivery networks keep copies of the files a page uses: images, style sheets and scripts. They do not keep the page itself, because on WordPress the HTML is built fresh by PHP and can differ from one visitor to the next. A content delivery network (CDN) is a set of servers around the world that keep copies near your visitors; see what is a CDN for the basics.

APO goes one step further. Cloudflare's documentation says it serves your entire WordPress site from Cloudflare's network by caching dynamic content, including the HTML. Cloudflare built it on its Workers platform, which runs code inside its data centers. The Cloudflare plugin for WordPress tells Cloudflare when a page changes, so the saved copy is replaced.

In short, APO is a page cache that lives at the edge of Cloudflare's network instead of on your server. If you already know WordPress caching, it is the page cache layer moved closer to the visitor.

What it changes for a visitor

The main effect is on Time to First Byte (TTFB), the wait before the first byte of the page arrives. Without a page cache, every visit makes WordPress run its code and query the database. With a page cache on the server, the visit still travels all the way to your host. With APO, a cached page is answered from a Cloudflare data center, and your server is not asked at all. Cloudflare's documentation says this aims to make TTFB "both fast and consistent".

A faster first byte moves the other loading times forward too, because nothing else can start before it. First Contentful Paint and Largest Contentful Paint (LCP) both begin after TTFB. See how to fix a slow LCP for how the time splits up.

There are limits, and they matter:

APO also adds two smaller optimizations. Cloudflare says it caches some third-party scripts, and it serves Google Fonts files from your own domain. You can see the font change in the page: the address starts with your domain followed by fonts.gstatic.com.

What APO caches and what it skips

Cloudflare publishes the rules. A response is saved as a page only when all of these are true:

When a request misses any rule, it goes to your server and the response shows cf-cache-status: DYNAMIC. The cf-apo-via header says why.

The cookie rule is what keeps private pages safe. A logged-in visitor carries a wordpress_ cookie, and a shopper carries a woocommerce_ cookie once the cart has something in it. Both are sent past the cache, so one person's page is not shown to another.

What you need before you switch it on

NeedWhat the documentation says
Cloudflare nameserversThe setup steps have you move your domain's nameservers to Cloudflare
The Cloudflare pluginAPO works through the official Cloudflare plugin for WordPress
A plan that includes itOn the Free plan you buy APO as an add-on first. Pro and higher plans include it
A single-site WordPressThe plugin does not support WordPress multisite
One zone for the domainAPO does not work with an Enterprise subdomain setup where www sits in a different zone from the root domain

The plugin also sets an API token connection between WordPress and your Cloudflare account. Cloudflare's guide uses a ready-made WordPress token template for this. Treat the token like a password: keep it in the plugin settings and nowhere else.

How to switch it on

These are Cloudflare's steps, in order:

  1. Check your DNS records in the Cloudflare dashboard, then change your nameservers at your registrar. The change can take up to 24 hours.
  2. On the Free plan, go to Speed, then Settings, then Content Optimization, and buy Automatic Platform Optimization for WordPress.
  3. In WordPress, install and activate the plugin named Cloudflare.
  4. In the Cloudflare dashboard, create an API token from the WordPress template.
  5. In the plugin's settings, sign in with your email and the token, apply the recommended settings, and turn Automatic Platform Optimization on.

Cloudflare suggests one more step before you start: run a speed test on your current site. Do that with the same tool and the same pages you will test afterwards, so the before and after numbers compare like with like.

How to check that it works

Three response headers tell you. Cloudflare's documentation gives this test from a terminal. The accept header makes the request look like a browser asking for a page:

curl -svo /dev/null -A "CF" 'https://example.com/' -H 'accept: text/html' 2>&1 | grep 'cf-cache-status\|cf-edge\|cf-apo-via'

Run it twice. The second answer should show:

HeaderValue when APO serves the pageWhat it tells you
cf-cache-statusHITThe page came from Cloudflare's cache
cf-apo-viatcache or cacheAPO handled the request
cf-edge-cachecache,platform=wordpressThe plugin is installed and allows caching

Then publish a small change to a page and load it again. The plugin should clear the old copy, and the next visit should show your change and, on the visit after, a HIT.

Living with it

A few behaviors surprise people after launch:

APO and other caching plugins

Two page caches in a row can serve old pages and make problems hard to trace. Cloudflare recommends turning off caching plugins such as WP Rocket or W3 Total Cache while you set up APO. After APO works, turn them back on one at a time and test whether they help or cause trouble. Clear their caches after APO is active.

Cloudflare lists plugins it supports with APO, including WooCommerce, WP Rocket from version 3.8.6, Redis Object Cache and Object Cache Pro. An object cache is a different layer: it saves database answers inside WordPress, which still helps logged-in visitors and the pages APO skips. The WooCommerce speed guide explains why stores depend on it.

When APO is the wrong tool

Mistakes to avoid

Check your own page

Run the free audit on your home page and on a busy post. Look at the server response time and at Largest Contentful Paint. If the first byte is slow but the page is light, an edge page cache such as APO is likely to help. If the first byte is already fast, look at images and scripts first.

Sources

Start here

Free website audit

Live Google data for any public page: mobile and desktop.

Mobile + desktop · Lighthouse lab test · Real-user Chrome data when Google has it

Rather have this done for you? WordPress speed · Book a call

Related guides

All guides →