There are definitely more reasons to use Cloudflare for WordPress websites these days than there used to be, especially with the increasing use of AI for malicious purposes.
No matter how fast and secure your hosting provider’s infrastructure, your website’s reliability depends on what you put on top of that.
You’ve probably noticed how frequent WordPress core updates (maintenance releases) have become to cope with new vulnerabilities that are discovered almost every day.
Not to mention PHP2Shell, a pair of critical remote code execution flaws in PHP 5.4 through 8.5, disclosed in October 2026. Researchers found them with the help of AI models, and attackers were already probing for them before the patches were out.
AI has made finding vulnerabilities faster for attackers too, and the gap between disclosure and the first attacks keeps shrinking. Cloudflare deployed WAF rules against PHP2Shell hours before the PHP patches were released, and sites on the free plan were protected automatically. You still need to update PHP, but Cloudflare buys you time.
WordPress sites feel this more than most. WordPress powers over 40% of all websites, so a single flaw in PHP, WordPress core or a popular plugin exposes millions of sites at once. That makes it one of the most targeted platforms on the internet.
Security is only half the story, though. The same network that filters out attacks also serves your pages from locations close to your visitors, takes load off your server and keeps your site online when traffic spikes.
In this step-by-step guide, you’ll learn how to set up Cloudflare for your WordPress website, improve load times, protect against security threats, and improve its reliability.

What is Cloudflare?
At its core, Cloudflare is a global network that sits in front of your website.
It speeds up your site by serving files from data centers close to your visitors. These data centers are called edge locations, and together they make up Cloudflare’s “edge.”
It also protects your site by filtering out harmful traffic before it reaches your origin server. The origin server is where your website is actually hosted.
Why use Cloudflare for WordPress?
Your hosting provider handles the server. Cloudflare handles everything that tries to reach it. Here’s what that means for a WordPress site, today.
- Faster load times worldwide. Cloudflare serves your images, CSS, JavaScript, and fonts from edge locations close to your visitors. By default, it does not cache your HTML pages. You can enable full-page caching with Cache Rules for bigger gains and preload your pages on Cloudflare edge network to improve TTFB (time to first byte) even further.
- Less work for your origin server. Every cached file is one less request your server has to handle. This frees up resources for the requests that matter, like logged-in users and pages that can not be cached.
- Protection from vulnerability scans. Bots probe WordPress sites all day for weak plugins, exposed files and login pages. Cloudflare’s Free Managed Ruleset automatically blocks widely exploited vulnerabilities like PHP2Shell, and custom WAF rules let you block the rest.
- Control over AI crawlers. You can allow or block AI Search, Agent and Training crawlers separately, even on the free plan. Some crawlers, like Googlebot, do both search and training, so check how Cloudflare handles them before you block Training.
- Bot and DDoS protection. Cloudflare filters out known bad bots and absorbs DDoS attacks, while search engines and other good bots still get through. It can also add your AI crawler preferences to your
robots.txtwith managed robots.txt. - A hidden origin IP. Visitors and attackers only see Cloudflare’s IP addresses. This makes it much harder to target your server directly.
- Free SSL and HTTPS. Cloudflare issues a free SSL certificate for your domain. To also encrypt traffic between Cloudflare and your server, use “Full” or “Full (strict)” mode. Full accepts any certificate on your server. Full (strict) requires a valid one and is more secure. Cloudflare’s free Origin CA certificate works with Full (strict) and lasts up to 15 years, since only Cloudflare needs to trust it. Install it once and forget about renewals.
- Better Core Web Vitals. Time to First Byte (TTFB) is usually the biggest part of Largest Contentful Paint (LCP). Caching your HTML at the edge with Cache Rules can cut TTFB to under 100 ms. This one change often brings the biggest LCP improvement.
Best of all, every feature above is included in Cloudflare’s free plan. You don’t need a paid subscription to get faster load times and solid protection for your WordPress site.

How to set up Cloudflare on WordPress (step by step)
Putting Cloudflare in front of your site is easier than you might think.
During setup, Cloudflare gives you two nameservers. You replace your current nameservers with these at your domain registrar. From then on, Cloudflare manages your domain’s DNS.
1. Create a free Cloudflare account
- Go to https://www.cloudflare.com
- Click Sign Up and create your account
- Enter your domain (e.g., yourdomain.com)
2. Scan your DNS records
- Cloudflare will automatically scan your existing DNS records
- Review the records and compare them with your current DNS. Cloudflare’s scan doesn’t always find everything. Pay special attention to your MX records (email), any subdomains and TXT records like SPF. If one is missing, your email can stop working the moment you switch.
- If DNSSEC is turned on at your registrar, turn it off before you change nameservers. You can enable it again later from Cloudflare. Leaving it on is a common reason the switch gets stuck or the site stops resolving.
- Click Continue
You will see a similar screen to the one below. Proxied means that the traffic will go through Cloudflare network.

3. Update nameservers
- Cloudflare will provide you with two new nameservers
- Log in to your domain registrar (e.g., GoDaddy, Namecheap, etc.)
- Replace the current nameservers with the ones provided by Cloudflare
- Save changes and wait for propagation (usually within an hour)
4. Configure SSL settings
- In your Cloudflare dashboard, go to SSL/TLS
- Make sure the SSL mode is Full or Full (strict), so your visitors reach your site securely via HTTPS. Don’t use Flexible: on WordPress it usually causes a “too many redirects” loop.
- Enable Always Use HTTPS and Automatic HTTPS Rewrites

Tip: If you want to make the connection between Cloudflare and your origin server secure, you can set the mode to Full (strict). Cloudflare provides free Origin SSL (valid for 15 years) for this purpose.
You can install it on your origin server through your own hosting control panel.
Don’t use Let’s Encrypt or similar on the origin server as they won’t be able to auto-renew while your domain points to Cloudflare nameservers.

5. Install a Cloudflare plugin for WordPress
You can either choose to use the official plugin, or install the Super Page Cache plugin (my preferred choice).
I like to use Super Page Cache (free version) because it creates and manages Cache Rules that cache full HTML pages at Cloudflare’s edge. It also purges the cache automatically when you update content and bypasses dynamic pages like cart, checkout, and wp-admin.
The official Cloudflare plugin offers full-page caching only through Automatic Platform Optimization (APO), which costs $5 per month on the free plan.
Using the official Cloudflare plugin
If you plan to use APO, or you simply want to manage Cloudflare from inside wp-admin, the official plugin is the way to go. Here’s how to connect it:
- Go to Plugins > Add New Plugin, search for “Cloudflare” and install the plugin published by Cloudflare.
- Activate it, then open the plugin’s Settings.
- In your Cloudflare dashboard, go to the Account API tokens page, click Create Token and use the WordPress template.
- Back in the plugin, sign in with your Cloudflare email and the new token, then click Save API Credentials.
- Next to Apply Recommended Cloudflare Settings for WordPress, click Apply.
- If you’ve bought APO, turn on the Automatic Platform Optimization toggle.
Keep in mind that the plugin is only a control panel. It does nothing until your domain is active on Cloudflare (steps 1–3 above), and you don’t need it at all to use Cloudflare’s CDN, SSL or firewall. It also doesn’t support WordPress multisite.
Don’t run the official plugin and Super Page Cache together. Pick one, or they’ll both try to manage the same cache. If you switch to APO, turn off other caching plugins during setup and clear their cache afterwards.
Using Super Page Cache
Go to Plugins > Add New Plugin, search for “Super Page Cache” and install it. After activating it, connect it to your Cloudflare account with an API token, following the plugin’s instructions. Then turn on Enable Cloudflare CDN & Caching so it creates the Cache Rule for you.

Super Page Cache vs Cloudflare APO
Cloudflare’s Automatic Platform Optimization (APO) for WordPress is a paid feature that caches full HTML pages at Cloudflare’s edge.
It costs $5 per month per domain on the free plan and is included in Pro and higher plans. Super Page Cache does the same core job for free by creating Cache Rules on your Cloudflare account.
Both purge the cache automatically when you update content. Both skip logged-in users and dynamic pages like the cart, checkout, and account area. Both can cut your TTFB dramatically on cached pages.
The main difference is how cached pages reach each edge location.
APO stores your cached pages across Cloudflare’s wider network, so edge locations can serve them without asking your server first. This means visitors in quieter regions get fast responses more often.
With Super Page Cache, each edge location caches a page only after someone in that region requests it. Until then, visitors in less busy locations still wait for your origin server.
Super Page Cache has a built-in preloader, but it sends requests from your own server. That only warms the edge location closest to your server, not the ones near your visitors.
This is the gap our plugin, Super Preloader for Cloudflare, is built to close.

It warms up Cloudflare edge caches by preloading your public URLs using a Worker script and optional rotating Webshare proxies.
By sending requests from different locations around the world, it fills the cache at many edge locations before real visitors arrive.
Super Page Cache decides what gets cached and when it gets purged. Super Preloader makes sure those cached pages are ready in the regions where your visitors are.
Together, they bring you close to APO’s global coverage without the monthly fee.
Super Page Cache with Super Preloader is a great fit if you:
- Manage several sites and don’t want to pay $5 per month for each one
- Want full control over cache rules, exclusions, and preload schedules
- Have visitors spread across a few key regions and want those edges always warm
- Are comfortable deploying a Cloudflare Worker
APO is the better choice if you:
- Prefer a set-and-forget setup with no extra plugins or Workers
- Have a truly global audience with low traffic per region
- Already pay for a Cloudflare Pro plan, where APO is included
For most small and medium WordPress sites, Super Page Cache delivers APO-level speed for free. Adding Super Preloader extends that speed to visitors far from your server.
How to check Cloudflare is working
Don’t assume it works just because the setup finished. Here’s a 30-second check:
- Open your site in a private browser window, so you’re not logged in.
- Open your browser’s developer tools (F12), go to the Network tab and reload the page.
- Click the first request (your page itself) and look at the response headers.
- Find
cf-cache-status.
What the value means:
- HIT: Cloudflare served the page from its edge. This is what you want for full-page caching.
- MISS: Cloudflare didn’t have it yet and fetched it from your server. Reload once and it should turn into HIT.
- DYNAMIC: Cloudflare isn’t caching this page at all. That’s normal without Super Page Cache or APO, and correct for cart, checkout and wp-admin.
- BYPASS: a cache rule skipped this request on purpose, usually because you’re logged in. Test again in a private window.
If your HTML pages keep showing DYNAMIC after setting up Super Page Cache, check that the plugin created its Cache Rule in your Cloudflare dashboard, then purge the cache and test again.
You can also watch the cached vs uncached numbers in your Cloudflare dashboard analytics once real traffic comes in.
My custom WAF rules for improved WordPress security
I have been working with WordPress and Cloudflare for years, and these are the custom WAF rules I apply to almost every site I manage.
They block the most common attacks before they ever reach WordPress. All of them work on Cloudflare’s free plan, which allows up to five custom rules.
1. Blocking rules
This rule blocks two of the most scanned endpoints on WordPress sites: xmlrpc.php and the REST API batch endpoint targeted by the wp2shell vulnerability.
Unless you’re using apps like Jetpack or the WordPress mobile app, xmlrpc.php should be blocked. It’s an old API that most sites no longer need.
Attackers use it for brute-force login attempts, since a single request can test hundreds of passwords.
The wp2shell vulnerability is a newer and more serious threat. It combines an SQL injection in the WP_Query class (CVE-2026-60137) with a bug in the REST API batch endpoint (CVE-2026-63030).
The entry point is the batch processing endpoint at /wp-json/batch/v1.
Attackers are scanning the internet for vulnerable sites, uploading malicious plugins and web shells, creating admin accounts, and running remote commands. If you think your site was already hit, follow our malware removal guide.
This vulnerability is fixed in WordPress versions 6.8.6, 6.9.5, 7.0.2, or newer, but attackers still probe for it on every site they find. Each of these requests reaches WordPress and PHP, which costs CPU time and slows your server for real visitors.
Blocking them at Cloudflare’s edge stops this waste before it ever reaches your origin server.
Steps:
- Log into your Cloudflare Dashboard
- Go to Security > Security rules
- Click Create rule
- Enter any rule name (e.g. Blocking)

Fill out the form as in the sample rule set below:
- URI Path > contains >
/xmlrpc.php - URI Path > contains >
/wp-json/batch/v1 - Choose action: Block
- Click Deploy to save

Your site is now protected from xmlrpc-based exploits and wp2shell attacks.
2. Managed Challenge rules
I like to use Managed Challenge rules to filter traffic from countries or networks where most probing bots come from.
Managed Challenge doesn’t block visitors outright. Cloudflare runs a quick check in the browser, and most real visitors pass without even clicking anything. Automated scripts usually fail and never reach your site.
From my experience, vulnerability scanning bots usually originate from the following countries and IP blocks.
Countries:
- Tor (Onion network)
- Netherlands
- South Korea
- India
- Singapore
- Taiwan
- Hong Kong
- Lithuania
IP blocks:
34.0.0.0/835.0.0.0/845.0.0.0/820.0.0.0/8
You can fine-tune these based on your real traffic and your target audience, which you can monitor using the Security > Analytics tab in your Cloudflare dashboard.
To add a Managed Challenge rule, click the same Create rule button you used for the blocking rule.
Steps:
- Country > is in > Type in countries
- IP Source Address > is in > Type in individual IPs or preferably IP blocks (e.g.
34.0.0.0/8means all IPv4 IP addresses that start with 34) - You may add extra OR cases here if you notice any other pattern of requests coming from bots
- Choose action: Managed Challenge
- Click Deploy to save

Make sure to monitor your traffic using the Security > Analytics tab of Cloudflare and fine-tune these later on.
You will be amazed to see the endpoints they are trying to reach, from .env files to all sorts of configuration files, searching for a leftover file that might contain sensitive login credentials.
3. Rate limiting rules
The wp-admin area is a common target for brute-force login attempts. Rate limiting helps you stop attackers from hammering your login form, thus using unnecessary CPU resources.

Steps:
- Go to Security > Security rules
- Click Create rule > Rate limiting rule
- Rule name: Rate Limiting
- URI Path > contains >
/wp-login.php - Requests: 3 (adjust this if necessary)
- Period: 10 seconds
- Choose action: Block
- Duration: 10 seconds
- Click Deploy to save.

Frequently asked questions
Is Cloudflare good for WordPress?
Yes, for almost every site. The free plan gives you a CDN, free SSL, DDoS protection and up to five custom firewall rules. Those rules can stop bots and login attacks before they reach WordPress.
Is Cloudflare free for WordPress?
Yes. Everything in this guide works on the free plan. The only extra I mention is APO, a $5 per month add-on on the free plan. Super Page Cache gives you full-page caching without it.
Do I need the Cloudflare plugin to use Cloudflare?
No. Once your nameservers point to Cloudflare, your site already goes through Cloudflare’s network. A plugin only adds automatic cache purging and full-page caching control from wp-admin. You need the official plugin if you use APO.
Do I still need a caching plugin with Cloudflare?
Usually yes. By default Cloudflare caches images, CSS and JavaScript, not your HTML pages. Super Page Cache or APO handles the HTML, so your server doesn’t rebuild every page on every visit.
Why does my site show “too many redirects” after adding Cloudflare?
This is almost always the SSL mode. With Flexible, Cloudflare talks to your server over HTTP while WordPress or your host redirects to HTTPS, so the request loops forever. Set SSL/TLS to Full or Full (strict) and the loop stops.
Does Cloudflare work with WooCommerce?
Yes. Just make sure cart, checkout and My Account pages are never cached. Super Page Cache and APO both skip these pages by default. If you write your own Cache Rules, exclude them yourself.
Will Cloudflare slow down or break my site?
It shouldn’t. Problems usually come from caching pages that must stay dynamic, or from optimization toggles that rewrite your JavaScript. If something breaks after a change, turn that setting off and purge the cache.
Conclusion
With these extra layers of security, your WordPress site becomes much harder to target, especially for automated attacks.
Your server no longer has to respond to an endless flood of bot requests. This saves precious server resources and can help you lower your hosting costs.
Combined with full-page caching at the edge, your site stays fast for real visitors, even when bots are knocking at the door.
Best of all, you can set up everything in this guide on Cloudflare’s free plan.
Need help setting up Cloudflare for WordPress?
At WP Fix Fast, Cloudflare setup is included in all our WordPress support plans. Let our experts handle it for you. Quick, secure, and stress-free.




