Cloudflare speeds up websites and protects them from attacks – it’s what they’re known for. WordPress runs millions of sites but often slows down when traffic grows.
Put the two together and you get a faster 🚀, safer 🛡️ site that’s easier to manage 🙌. That’s what this post shows you. I’m going to show you how to set up Cloudflare for WordPress.
I’ll start at Cloudflare itself, where you set up your domain first. That’s the first step before touching WordPress. Then I’ll show how to connect Cloudflare with WordPress so you can use all of its features.
This guide is for anyone running a WordPress site who wants better speed and security without guesswork and without actually having to spend any additional money.
Let’s get into it! But first:
How does Cloudflare benefit your WordPress site? 💡
If you’re not familiar with Cloudflare, here’s a rapid-fire list of some of the benefits of using Cloudflare for WordPress:
- CDN – Cloudflare’s content delivery network helps speed up your site by serving your static content from a huge network of global servers. Cloudflare is the most popular free CDN service.
- DNS – Cloudflare is one of the fastest DNS providers (data), which can speed up your site’s time to first byte (TTFB) a lot.
- Security rules – Cloudflare lets you set up custom security rules to secure specific parts of your site, like your WordPress dashboard.
- DDoS protection – Cloudflare can help you protect against distributed denial of service (DDoS) attacks. It can also help you just generally filter out malicious traffic.
- Other performance benefits – Cloudflare can help you minify your code, enable Brotli compression, and implement other performance best practices.
How to set up Cloudflare for WordPress 🤔
Before you can start configuring the other options in Cloudflare, you need to connect your site to Cloudflare.
Long story short:
In order for Cloudflare to work, it needs to be able to manage your domain’s nameservers so that it can serve up cached content from its CDN and filter out malicious actors.
To do that, you’ll need to change your domain’s nameservers to Cloudflare, which is what most of the basic setup process entails.
Here’s how to do it:
1. Create your free Cloudflare account
To get started, go to Cloudflare and sign up.
On the next page, you can enter the domain name of the WordPress site that you want to use with Cloudflare and click Continue at the bottom of the page.

Next, you’ll be prompted to choose a plan. You can choose the Free plan confidently, as it offers all the features most WordPress sites need:

2. Verify DNS records
Once you choose your plan, Cloudflare will scan your site’s DNS records.
If you’re not sure what’s going on here, don’t worry. The only thing you need to verify is that you see an orange cloud next to your main domain name (which you should see by default – no action required):

Simply click on Continue to activation.

3. Update your domain’s nameservers to point to Cloudflare
Now, Cloudflare will give you a new set of nameservers to replace your existing nameservers:

Nameservers are part of what you use to connect your domain name to your web hosting. When you switch to Cloudflare’s nameservers, Cloudflare is able to direct traffic to your website. It uses this power to:
- Filter out malicious traffic – it will send regular traffic to your website just like normal, while filtering out malicious actors before they can reach your site.
- Deliver static content from the closest server in its huge global network (the CDN part)
How you will change your nameservers depends on where you registered your domain name. Here are tutorials for some of the most common domain name registrars:
Here’s what it looks like at Namecheap…
First, here’s how my domain name was configured before connecting it to Cloudflare:

And here’s what it looks like after updating my nameservers to point towards Cloudflare:

Once you’ve changed your domain’s nameservers, go back to the Cloudflare interface and click Check nameservers now.

⚠️ Nameservers can take up to 48 hours to update, so you might need to wait a bit for Cloudflare to update. Don’t panic and think you made a mistake unless it’s been at least 24 hours.
4. Verify that your connection is complete
Once your new nameserver settings have propagated, you’ll see a success message like this one in your Cloudflare panel:

And that’s it! You just set up Cloudflare to take care of your website and work behind the curtains to make your site much faster.
The core steps of the process are now done, but we can actually go much further and configure your WordPress setup to take full advantage of Cloudflare and all its abilities. The thing is that, by default, WordPress doesn’t have any specific customizations or settings for proper Cloudflare integration. Luckily, there are some plugins to make it all work, and they basically need next to zero work in terms of setting them up.
In this next section, I’m going to show you how to go the extra step and make your WordPress website 100% compatible with Cloudflare.
How to 10x your Cloudflare setup and go to sub-1-second load times 🚀
We’re going to use the free Super Page Cache plugin.
What’s great about it is that it sets some custom Cloudflare optimizations for your site and lets you hook up to Cloudflare’s CDN edge network and advanced caching.
What this means in plain English is that Cloudflare will take your site’s content and deliver it to your visitors through its own network of servers, which results in much faster load times and thus better overall experience for your audience.
The installation is very simple:
a) Install the plugin from the WordPress dashboard
Just put in “Super Page Cache” into the plugin search field, and then install and activate the plugin:

b) Enable the main features
Go into Super Page Cache → Settings → General tab.
In there, make sure that the Enable Disk Page cache toggle is switched on:

Then, switch to the Cloudflare tab to set the main integration:

The main thing to do here is to provide your Cloudflare email and your Global API Key. The email thing is simple – it’s the email you used to sign up to Cloudflare. As for the Global API Key, here’s how to get it:
c) Get your Cloudflare Global API Key
Go back to Cloudflare, click on your profile image in top right. Go into API Tokens. You’ll see this:

Click on the View button next to Global API Key.
Cloudflare will ask you for your password again – for some added security, and then will show you the key.
Grab this API key and go back to your WordPress.
d) Enter the API key in WordPress
You’re looking at the following panel again:

Now you can enter both your Cloudflare email and the API key.
Click on Connect to Cloudflare.
In case you have more domains hooked up to your Cloudflare account, you might need to pick the correct one from the dropdown. Click on Save Domain.

Lastly, switch the Enable Cloudflare CDN & Caching toggle to on, and click on Update Settings.

At this stage, your WordPress site has been successfully integrated with Cloudflare – and with all of Cloudflare’s even advanced features working in your favor.
Get started with Cloudflare for WordPress today 🏁
If you want to speed up and protect your WordPress site, Cloudflare is one of the best free services that you’ll find.
While the setup process requires a little effort with changing your domain’s nameservers, it’s a one-time thing and, going forward, your site will benefit without you raising a finger.
Again, the basic process to use Cloudflare for WordPress is to:
- Create your free Cloudflare account.
- Change your domain’s nameservers to point to Cloudflare’s nameservers.
- Install the Super Page Cache plugin to optimize the configuration.
For some other ways to speed up your WordPress site, check out our guides to:
- Best WordPress Speed Test Tools
- Common WordPress Performance Problems
- Image optimization in WordPress
Do you still have any questions about using Cloudflare with WordPress? Let us know in the comments section!
Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!