WordPress powers a large part of the internet, and that popularity makes it one of the favorite targets of automated attacks. Vulnerability scans, brute-force attempts on the login and floods of malicious traffic don’t distinguish between large and small sites: all of them get scanned, all of them get probed.

Most security strategies focus on protecting the origin: security plugins, strong passwords and two-factor authentication. All of that is necessary, but there’s a layer that acts before the request even reaches your server: a CDN with firewall capabilities. Cloudflare is the best known, and the one that best fits most WordPress sites.

Why a CDN is a security layer, not just a performance one

A CDN (Content Delivery Network) distributes your site’s content across servers around the world so each user receives it from the nearest node, and that improves speed. But when the CDN is Cloudflare, it does something more: it sits between the internet and your origin server.

All requests go through its network first, where threats are filtered before they touch your hosting. Denial-of-service (DDoS) attacks, vulnerability scans, brute-force attempts and known malicious requests are blocked at the edge and not on your server.

The benefit is twofold: your site loads faster because content is served from nodes close to the user, and your server is protected because malicious traffic never reaches it. We cover the speed side in My website is slow: what can I do?.

What protections Cloudflare offers for WordPress

  • Web application firewall (WAF). It inspects every HTTP request and blocks those matching known attack patterns: SQL injection, cross-site scripting (XSS), remote file inclusion and WordPress-specific exploits. Cloudflare maintains managed rules that are updated continuously.
  • DDoS protection. Distributed denial-of-service attacks try to overwhelm your server with massive traffic until it stops responding. Cloudflare absorbs them across its global network, spreading the malicious traffic among its data centers and protecting your origin.
  • Bot Fight Mode. It detects and blocks malicious bots (scanners, scrapers, spammers) and lets legitimate crawlers like Googlebot through. It reduces junk traffic that consumes your server’s resources.
  • Free SSL/TLS and automatic HTTPS. It provides free SSL certificates and can force HTTPS across the whole site, encrypting communication between the user and your site.

How to set up Cloudflare without breaking your WordPress

The most common mistake when setting it up is turning on the protections and discovering that the WordPress admin dashboard stopped working. The firewall blocks legitimate requests because it can’t tell an attacker from an administrator until you teach it to. The right process has three stages.

Stage 1: enable the base protections

Register your domain on Cloudflare and change the nameservers at your registrar. Make sure the main DNS record has the orange cloud turned on (proxied): that routes traffic through Cloudflare. Then enable the managed rules, with the WordPress-specific ones turned on, and check that the XSS and SQL injection ones are active.

Stage 2: restore the admin dashboard’s functionality

This is the critical part. With the protections on, try actions in the WordPress dashboard: log in, upload an image, save a setting. Some will fail, and Cloudflare logs every block in the firewall events.

Review those events and identify which rules block your administrative actions. With that information, create an exception rule (Skip Rule) that excludes those specific rules for the admin section. It has to be as precise as possible: apply it only to the /wp-admin/ path and, if you can, combine conditions such as the source IP or a session cookie to limit its scope.

The logic is that the firewall protects the whole site, but in the admin section, which only your team accesses, the rules that interfere with normal operation are skipped. That area’s security is guaranteed by other means: strong passwords, 2FA and access restriction.

Stage 3: restrict access to the dashboard

With functionality restored, the next step is to limit who can get into the dashboard. Cloudflare offers Zero Trust, which lets you restrict access to /wp-admin/ based on the user’s identity and not just their IP. If that isn’t feasible, you can use firewall rules to allow access only from known IPs, such as your office or your VPN: any attempt from another IP is blocked before it reaches WordPress.

What Cloudflare does NOT do (and what remains your responsibility)

Cloudflare is a layer of defense, not a complete solution. Some things still depend on you:

  • Weak passwords are still a problem. The firewall stops automated attacks, but if your password is “admin123”, anyone who knows your username can get in. Use strong, unique passwords and turn on two-factor authentication.
  • Outdated plugins are still vulnerable. Cloudflare blocks known exploits, but a new one can slip through. Keep everything up to date, as we explain in Complete guide to maintaining your website and WordPress.
  • The origin server’s security still matters. If Cloudflare filters the traffic but your hosting is poorly configured, an attacker who finds your server’s real IP can bypass Cloudflare entirely. Some hosts hide the origin IP and others don’t: ask your provider. To understand what influences this, see What is web hosting.
  • A bad configuration can break your site. If you create rules that are too broad or block Googlebot by mistake, your SEO suffers. Check the firewall events regularly and adjust the rules carefully.

Cloudflare doesn’t replace the rest of WordPress security: it stops the noise at the edge so that what reaches your server is much smaller and easier to control.

If you want to understand why all this is part of ongoing maintenance, see The vital importance of web maintenance and WordPress maintenance, and if you’d rather delegate it, ask us about our Web Support service.