Wordfence vs Cloudflare: why you want both

Running both is the right answer. The setup has three places where people quietly undo it.

TL;DR

Most small WordPress sites are guarded by a security plugin and nothing else, which puts the whole defense on the same machine the attacker is aiming at. Cloudflare and Wordfence work in different places, and each one is blind to what the other catches. One filters traffic before it reaches your hosting; the other watches what happens inside the site. Neither one is a security plan on its own.

If Wordfence is your security plan, every attack still reaches your server before anything blocks it. That is the part people skip over when they look up Wordfence vs Cloudflare expecting a winner. Wordfence does block attacks, and that part is real. It also lives on your server, so by the time it says no, the request has arrived, woken up PHP and spent your hosting’s resources. It wins the fight. Your hosting still pays for it.

The way I explain it to clients: Wordfence is the guard in the lobby, Cloudflare is the gate at the parking lot entrance. With only the guard, everyone still gets into the building first.

The short answer: Wordfence vs Cloudflare

Use both, and put Cloudflare in front. Cloudflare acts on requests while they are still crossing its own network, so a request it drops costs you nothing: no bandwidth, no PHP process, no database query. Wordfence acts on your server. Its firewall is built to load through the PHP setting auto_prepend_file, which the plugin says “ensures it runs before any potentially vulnerable code runs”, and that is as early as anything installed on a site can get. Early is not free: the connection, the bandwidth and the PHP startup are spent before the rule fires.

Neither one covers the other’s ground. Cloudflare has no view inside the site, so a changed core file, malicious code in a plugin or an administrator with a breached password means nothing to it, and Wordfence reads all three. Both have a free tier that is enough for a small business site, and on Cloudflare’s Free plan the Free Managed Ruleset is deployed for you.

Cloudflare vs Wordfence in the request path

One request, five steps, from a stranger’s machine to your database.

StepWhere it happensWhat happens there
1A visitor, or an attackerThe request starts on hardware you do not own.
2Cloudflare’s networkWith the DNS record proxied, Cloudflare sits between the visitor and your server. Managed rules, rate limiting, bot challenges and Under Attack mode all run here. A request stopped here never touches your hosting.
3Your hostingWhatever survives step 2 arrives as a real connection: bandwidth, a web server process, and for anything uncached, PHP.
4Wordfence, inside PHPThe firewall inspects the request. In Extended Protection it loads through auto_prepend_file, ahead of your site’s code. In Basic WordPress Protection it loads as a plugin, after WordPress has started.
5WordPress and its databaseWhatever both layers allow runs your theme, your plugins and your queries.

One setting decides whether step 2 is real: the proxy status on the record in Cloudflare’s DNS tab. When a record is Proxied, Cloudflare sits between your visitors and your server and applies your product configuration, including WAF rules, caching and redirect rules, to incoming traffic. When it is DNS-only, Cloudflare answers with your server’s actual IP address and routes no HTTP traffic through its network, so every rule you set sits out the game. Only A, AAAA and CNAME records can be proxied; MX and TXT records are always DNS-only.

What Wordfence sees, and what it cannot stop

Wordfence calls itself an endpoint firewall, and endpoint is the argument: running on the server lets it see what a network cannot. Why it is the best WordPress security plugin for most sites is a separate post. Here the question is narrower. By its own description, the scan:

  • Compares your files with the WordPress.org repository, core files, themes and plugins, and reports anything that changed.
  • Looks for malicious code, bad URLs, backdoors, SEO spam, malicious redirects and code injections.
  • Checks for known vulnerabilities, and warns when a plugin has been closed or abandoned.
  • Checks accounts. The option is called “Check the strength of passwords”; the scan step reports as scanning for weak passwords.

On top of the scan it limits login attempts, offers two-factor sign in through any TOTP app, passkeys, a login page CAPTCHA and options for XML-RPC, and blocks administrator logins using a known compromised password. Its throttling sits behind one checkbox, “Enable Rate Limiting and Advanced Blocking”, with thresholds worded “If a crawler’s page views exceed” and “If a human’s page views exceed”. That checkbox also gates IP, country and advanced blocking, so turning it off turns off more than people expect.

No network service can do any of that. It also all happens on the machine under attack, which is the limit. Wordfence cannot stop the request arriving, because it only exists once the request has arrived, and it cannot refuse the bandwidth or decline the PHP process. Extended Protection is early and still inside PHP; Basic WordPress Protection is later still.

One more thing on the free version: new firewall rules and malware signatures reach free installs 30 days after Premium ones, which Wordfence states plainly in the plugin’s own listing. For a flaw being exploited the week it is published, 30 days is the whole event.

What Cloudflare sees, and what it is blind to

Once the record is proxied, Cloudflare decides about your traffic before you hear about it. On the Free plan that means:

  • The Cloudflare Free Managed Ruleset, deployed by default on Free, covering high-impact and widely exploited vulnerabilities. The broader Cloudflare Managed Ruleset and the OWASP Core Ruleset start at Pro, and on Free the WAF inspects at most 1 MB of a request body.
  • One rate limiting rule, counting by IP, with a 10 second counting period, a 10 second mitigation timeout, and only Path and Verified Bot usable in the expression. Pro raises that to two rules and periods up to a minute.
  • Bot Fight Mode, free, which spots traffic matching patterns of known bots and answers it with computationally expensive challenges, so automated requests cost the sender something. It cannot be customized through WAF custom rules, it applies to the whole domain, and Cloudflare warns it may challenge API or mobile app traffic.
  • Under Attack mode, off by default, which puts an interstitial page in front of visitors. Cloudflare calls it one of the last resorts when a zone is under attack and says it temporarily pauses access to your site and affects your analytics.

The free tier is not a token. When the PHP2Shell flaws broke on 21 October 2026, Cloudflare deployed its new rules to every plan with the WAF, Free included, and did the same in July 2026 for two high severity WordPress vulnerabilities.

Now the blind spot. Cloudflare only ever sees requests, never your files, your database or your user table, so a core file modified last night, a plugin shipping malicious code, a weak administrator password and a stolen session are all outside its view. Worse for the edge-is-enough argument, plenty of real attacks arrive as requests that look completely normal. Patchstack counted 11,334 new vulnerabilities in the WordPress ecosystem in 2025, 91% of them in plugins, six in WordPress core, and 46% with no fix from the developer by the time the flaw was public. A managed rule stops the ones whose shape it recognizes. A form submission that trips a logic bug in a plugin has no shape to recognize, and Cloudflare’s own PHP2Shell post describes watching attackers change the payload to get around its rules.

What an attack costs your hosting, even when Wordfence wins

This is where a security argument turns into a hosting bill, and managed WordPress hosts publish their own numbers.

  • Kinsta calls them PHP threads and says they set how many simultaneous uncached requests a site can handle. Busy threads make a queue, the queue pushes out older requests and returns 504 errors, and a 502 follows a 60 second wait. Its WP 5 plans have 4 threads per site, Enterprise starts from 8, and if CPU is already pinned at 100% more threads do not help (updated 11 May 2026).
  • WP Engine puts it in one line: each uncached page request is handled by a PHP worker. Bots, AJAX and XML-RPC requests sit in lower priority queues, so they hit the 502s and 504s before real visitors do (updated 28 July 2025).
  • Pressable gives each Signature site 5 dedicated workers, with a burst to 110 on a best effort basis (updated 13 August 2026).

The numbers vary by host and plan, and most shared hosting publishes none of them, which usually means a CPU or process limit you learn about from a warning email. The shape of the problem does not vary: a finite number of PHP processes, and an attacker who does not care that your firewall is winning.

A brute force run makes it concrete. Cloudflare caches only GET responses, so a login attempt, which is a POST, travels the whole way to your server. Every guess takes a PHP worker, runs Wordfence’s check, gets refused and releases the worker. Wordfence is right every time. Your visitors still get the queue.

The traffic is there. Across 2025 Cloudflare mitigated 6.2% of the traffic it saw, 3.3% of it as a DDoS attack or by WAF managed rules, and on 2 December 2025 human visitors generated 47% of requests for HTML pages across its network against 44% from bots that were not AI crawlers. Not all of that is hostile. None of it needs to reach your PHP.

How to run Wordfence and Cloudflare together

Proxy your DNS

Move the domain’s nameservers to Cloudflare, then set the site’s A, AAAA or CNAME record to Proxied, the orange cloud. Proxying is on by default when you onboard through the dashboard, so the usual mistake is an old record someone flipped to DNS-only for troubleshooting and never flipped back. Your MX and TXT records stay DNS-only, which is how SPF, DKIM and DMARC keep working after the move.

Stop the origin answering for itself

This is the caveat that quietly undoes the whole setup. If your server still answers requests sent straight to its IP address, the gate is open and nobody is using it. Cloudflare’s guide to protecting your origin server lists the work:

  • Allow Cloudflare’s published IP addresses at the origin and block everything else. Cloudflare calls this one vulnerable to IP spoofing, so treat it as the floor.
  • Audit your DNS-only records, SPF and TXT among them, so none of them carries the origin’s address.
  • Rotate the origin IP after you onboard, because DNS records are public and historical records keep the address you had before Cloudflare.

Stronger again are Authenticated Origin Pulls, which checks requests came from Cloudflare’s network, and Cloudflare Tunnel, which connects the server outbound and needs no public IP address at all.

Tell Wordfence which address is the visitor

Behind a proxy, every request arrives from Cloudflare, so out of the box Wordfence can end up measuring Cloudflare instead of the attacker. The setting is called “How does Wordfence get IPs”, and the option you want is the one for the Cloudflare CF-Connecting-IP header, which the plugin labels with a warning of its own: only use it if you are using Cloudflare. Cloudflare’s side of the same deal is that CF-Connecting-IP carries the visitor’s address through to the origin, and is only sent on traffic from its edge to your server.

Get this wrong and rate limiting, country blocking and manual IP blocks all act on the wrong address, which at best does nothing and at worst locks out every visitor at once. Wordfence scans for a misconfigured value and warns you, so read that warning rather than dismissing it. Do not reach for the X-Forwarded-For option instead, which the plugin itself qualifies with “Only use if you have a front-end proxy or spoofing may result”. If the header never arrives, check whether Cloudflare’s “Remove visitor IP headers” transform is on.

Turn on what the Free plan already includes

The Free Managed Ruleset is deployed for you. Add your one rate limiting rule where it earns the most, which for most WordPress sites is the login path. Turn on Bot Fight Mode and watch for a week in case it challenges something of yours. Put Turnstile, Cloudflare’s CAPTCHA alternative, on your contact and comment forms; it embeds in any website, so it works even when the DNS is somewhere else. Leave Under Attack mode alone until you need it.

Keep the login and the admin out of the cache

Cloudflare will not cache a response carrying a Set-Cookie header or a Cache-Control of private, no-store, no-cache or max-age=0, and it caches only GET requests, so the defaults already leave logged in traffic alone. The risk is caching you add on purpose: if you write a cache rule for HTML, exclude /wp-admin/ and wp-login.php first, or you will serve one person’s dashboard to the next visitor. Cloudflare’s own WordPress plugin installs from the plugin directory and connects with an API token made in the dashboard, and Cloudflare recommends switching off other caching plugins, W3 Total Cache among them, while you set it up.

Leave Wordfence doing the part Cloudflare cannot

Switch the firewall to Extended Protection, keep the scan on a schedule, and put two-factor on every administrator account. Then be honest about the cost of the pair: two dashboards, two sets of alert emails, two places a false positive can come from, and the 30 day rule delay on free Wordfence. It is more work than one tool, and the only arrangement where something watches the door and the building.

When one of them is enough

Not every site needs the pair.

  • A static site with no logins and no PHP. This site is one: no database to protect and no admin to brute force, so a WordPress security plugin has nothing to do. Cloudflare alone is the whole plan.
  • A host that already runs an edge WAF. Some managed WordPress hosts run their own rules in front of your site. Ask them, in writing, which classes of request they block and whether they rate limit the login. A second firewall on top of a good one mostly produces alerts.
  • A site you cannot move the DNS for. A domain held by someone unreachable, or a legal department that controls the nameservers. Then Wordfence alone is what you have: Extended Protection, rate limiting with the right visitor IP setting, and Turnstile on the forms, which works without proxying.

What I would not do is run Wordfence alone on a busy site, on shared hosting, and call that a plan. That is the setup where one bad week costs you uptime without anything being breached.

What neither tool fixes

Both sit above the server’s own software, which is why neither covered the PHP2Shell flaws in October 2026: the bug was in PHP itself, under WordPress and under Wordfence. Cloudflare shipped rules for it to every plan within hours and still told customers to patch, because the only real fix was a new PHP build on the server, which is a different job entirely.

So the advice is narrower than “install these two”. Patch the server, patch WordPress, patch the plugins, then use the edge to keep the noise away from all of it and the plugin to tell you when something inside has changed. Get Cloudflare, proxy your DNS, stop the traffic before it costs you anything, and keep Wordfence, because the day something does get in, the network will be the last place to notice.

Sources

Read on 31 October 2026. Wordfence’s setting names and its own wording are taken from the official plugin distribution, version 9.0.2, and from the plugin’s listing on WordPress.org, both published by Wordfence.

Frequently asked questions

Do I need Wordfence if I use Cloudflare?

On a WordPress site, yes. Cloudflare acts on requests while they cross its network, so it never reads your files or your database. A modified core file, a backdoor written by a plugin, or an administrator using a password from a breach list is invisible to it and plainly visible to Wordfence. Cloudflare keeps junk off the server; Wordfence watches what is already on it.

Does Cloudflare work with WordPress?

Yes. You point your domain's nameservers at Cloudflare and set the site's A, AAAA or CNAME record to Proxied, and traffic routes through Cloudflare's network. Cloudflare also publishes its own WordPress plugin, connected with an API token made in the dashboard, and its managed rules carry a wordpress tag so you can find and adjust that group in bulk.

Is Cloudflare free for WordPress?

The Free plan covers what a small site needs: proxied traffic, the Cloudflare Free Managed Ruleset deployed by default, Bot Fight Mode, one rate limiting rule and Under Attack mode. The wider Cloudflare Managed Ruleset and the OWASP Core Ruleset start at the Pro plan, and request body inspection on Free stops at 1 MB.

Does Cloudflare slow down WordPress?

Proxying adds a stop on the way, and for a visitor far from your server it usually shortens the trip, because the files come from a Cloudflare location near them. What it cannot speed up is anything it will not cache: Cloudflare caches only GET responses and skips any response carrying a Set-Cookie header or a Cache-Control of private, no-store, no-cache or max-age=0. Carts, checkouts and logged in pages still go to your hosting.

What can Cloudflare not block?

Anything already inside the site, and anything that arrives looking ordinary. It cannot see a changed core file, malicious code in a plugin, a weak or reused administrator password, or a vulnerability exploited through a request that is valid in every visible way. Patchstack counted 11,334 new vulnerabilities in the WordPress ecosystem in 2025, 91% of them in plugins, and a managed rule only stops the ones whose shape it recognizes.

Do I still need a security plugin?

If the site runs WordPress and has a login, yes. The edge decides whether a request deserves to arrive; the plugin decides whether the site itself has been tampered with. Drop the plugin and nothing checks your files, your accounts or your plugin versions. The exception is a site with no PHP and no login at all, where there is nothing for a plugin to guard.

What is a WAF?

A web application firewall reads HTTP requests and blocks the ones that match known attack patterns, rather than filtering by port or address the way a network firewall does. Cloudflare runs one on its own network, before the request reaches you. Wordfence runs one on your server, through the PHP setting auto_prepend_file so that it loads ahead of your site's own code.