I have been dealing with slow Wordpress websites and Cloudflare earlier, so allow me to post a few suggestions. As noted by others in this post, Cloudflare will not cache your “pages”, but will cache static assets (jpg, css, js etc), which will improve performance slightly. Cloudflare will not cache “pages” by default, as that means it might cache user-specific dynamic pages also (like in WP). It also means you would not be able to update any pages without flushing the Cloudflare cache every time. Remember, creating just ONE new page in WP might cause the menu to shift across ALL pages, and might affect plugins also.
A) My main suggestion to you is to use a WP Cache plugin (perhaps you already are?). One of the main reasons WP is slow, is because of all the processing and database requests for each page request, which may cause slow output from the server. A WP cache plugin will create static cache fragments for all your pages, and since it’s native to your WP installation, it knows when pages get updated and the cache needs to get cleared. This will speed up the page output from your server tenfold, and is crucial for all WP websites that are on shared hosting.
Also, even if you are using Cloudflare PAGE-caching (see next point), Cloudflare won’t cache your pages on ALL their CDN servers, and will frequently flush the cached items. Therefore, you will always have requests that go directly to your origin server, regardless of Cloudflare caching or not. Therefore, you need to take action to optimize page speed directly from your server, regardless of Cloudflare, and the best way to get started with that, is by using a WP cache plugin.
B) If you really want to get serious about caching your pages on Cloudflare, it is tricky business, but definitely possible. There are a few ways to go about this, but the easiest way would be:
- Create a page-rule to A) “cache everything” and B) Edge Cache TTL “1 week” (for example).
- Create page-rules (before the one above) which excludes /wp-login.php* and /wp-admin* from being cached.
- You will also need to make sure your WP pages don’t display “logged in” user top bar. I’m not sure if that is a default option in WP these days, but it can definitely be achieved with a plugin.
When pages then get cached on the Cloudflare CDN, they will be served lightning-fast to the visitor. Keep in mind, the page may or may not exist on a specific Cloudflare CDN, so you will still get loads of requests to your origin server. It will definitely benefit a percentage of your requests. Perhaps most importantly, every time you now edit your website, you will need to flush the Cloudflare cache for your website … you might be able to flush a single page, but if the change you made affects menus or plugins, you may need to flush your entire Cloudflare cache.
Personally, I have used BOTH the above in combination to optimize WP page load speed. Outputting the main html document as fast as possible is by far the most crucial aspect of getting your WP pages loading fast for visitors. There are dozens of other factors to consider, usually reported (and often exaggerated) by website performance tools.