Set Up CloudFlare in WordPress

How to Set Up CloudFlare for WordPress to Improve Speed and Security

I think you’ll agree with me when I say that performance and security are two concerns on the minds of most WordPress site owners. So what if I told you that you can boost both with one simple tool? Guess what – you can. It’s called CloudFlare for WordPress.

In this post, I’ll briefly discuss what CloudFlare is and how it can benefit both your site’s performance and security. Then, I’ll give you a step-by-step guide for how to set up CloudFlare for WordPress.a I’ll make sure to include plenty of screenshots to make the process as simple as possible.

What is CloudFlare?

CloudFlare is a content delivery network (CDN) with built-in security features to protect your site from bots and malicious attacks.

Your next question might be: “What is a content delivery network”?

Normally, when a visitor lands on your site, they have to load all of your site’s data from one set location – your web server. If you’re located in North America, your web server is probably somewhere in North America as well.

That’s fine for visitors from North America – but not so great for people from, say, Europe. Data travels pretty fast nowadays, but that still takes noticeably more time than it would take to download it directly from a European server.

Content delivery networks eliminate this issue by storing your content at multiple global locations and serving it up from the location nearest to each individual visitor.

Here’s a visual representation of what that means from CloudFlare. The image on the left illustrates the effecgive speed when using a CDN. The image on the right is how things function without one:

How a CDN Works

CloudFlare operates differently than many other CDNs, though. It uses custom DNS to act as a proxy between your web server and your visitors, which allows it to also offer protection against bot traffic and other malicious actors.

What are the Performance Benefits of Using CloudFlare?

CloudFlare affects your performance in two ways:

  • Faster page speeds
  • Fewer server resources needed

Faster page load speeds are massively important to your WordPress site’s success:

According to CloudFlare, their content delivery network doubles the speed of an average website, which goes a long way to getting you to those fast page speeds that users want.

But CloudFlare isn’t just about speed, it can also lessen the load on your web server. The average website gets 60% fewer requests when using CloudFlare. And because CloudFlare is serving up some of your data from global data centers, your web server will also use less bandwidth.

What are the Security Benefits of Using CloudFlare?

In addition to the front-facing performance improvements, CloudFlare also works behind the scenes to protect your site in a number of ways.

First, CloudFlare’s free plan offers a shared SSL certificate. Not only does this secure your site by encrypting the traffic between your visitors and your web server, it also gets you into Google’s good graces and gives your site a small ranking boost in the search results.

Next, CloudFlare can help protect your website against something called Distributed Denial of Service (DDoS) attacks. Such attacks crash your site by flooding it with traffic, a particularly nasty approach that’s difficult to deal with by yourself.

CloudFlare Firewall

Finally, CloudFlare includes a web application firewall (WAF) which can protect your website against a slew of exploits like SQL injections, WordPress-specific attacks, and more.

Even if you already have a WordPress security plugin, CloudFlare adds another layer of security to your site.

Are there any Disadvantages to using CloudFlare?

There aren’t any glaring downsides to CloudFlare. But here are two things you might want to consider before making the switch:

  1. Because it acts as a proxy, you’ll need to point your domain nameservers to CloudFlare instead of your web host. While this is unlikely to be an issue because CloudFlare is a trusted company, if CloudFlare were ever to experience downtime, your site might go down as a result.
  2. Sometimes CloudFlare’s security can be overzealous. As a very real human person living in Vietnam, I’m still sometimes required to prove to CloudFlare that I’m not a bot. While this won’t affect most of your visitors (and yeah, this gripe might be a bit personal!), just remember that CloudFlare might inconvenience some legitimate visitors from “bot hotspots.”

When weighed against CloudFlare’s benefits, these potential disadvantages are fairly insignificant, though.

How to Set Up CloudFlare for WordPress

Now that you know what CloudFlare is and how it can help your WordPress site, I’ll show you step-by-step how to add the free version of CloudFlare to WordPress.

Step 1: Sign Up For a CloudFlare Account

To get started, head over to CloudFlare and sign up for an account:

How to set up CloudFlare for WordPress

Enter your details and click Create Account:

Create Account

Step 2: Add Your Website and Verify its DNS Records

Once you’ve created your account, you should see a screen requesting you to add your website. Just enter your domain name in the box and click Scan DNS Records:

Scan DNS Records

While CloudFlare scans your DNS records, they’ll show you a little explainer video. Once the timer reaches zero, you can click Continue to advance.

Next, you’ll see a screen that contains lots of potentially confusing information. It can definitely be overwhelming. If you’re an advanced user, you can configure some detailed settings here. But if you’re just a regular WordPress user, you really only need to look for one thing…

Make sure that there’s an orange CloudFlare icon next to your main domain name:

Orange Icon

This orange icon indicates that CloudFlare will act as a proxy and deliver your content via its CDN. Once you verify that you have the orange icon (it should be there by default), you can click Continue at the bottom of the page.

Step 3: Select Your CloudFlare Plan

On the next page, you’ll need to select your CloudFlare plan level. CloudFlare offers both free and premium options. At the end of the article, I’ll discuss some reasons you may want to consider the premium plans.

But for now, I recommend that you select the free plan. You can always upgrade later if needed.

Select Free Plan

Once you select your plan, click Continue at the bottom of the page.

Step 4: Update Your Nameservers to CloudFlare

Finally, you need to update your domain nameservers (DNS) to point to CloudFlare:

Update Nameservers

Unfortunately, I can’t show you exactly how to do this process because it depends on where you registered your domain. But to help you out, here are the guides from some of the most common domain registrars:

If you’re using another registrar, you’ll need to go to their knowledge base for specific instructions.

Once you know how to change your nameservers, all you need to do is change the current values to the new values provided by CloudFlare.

Don’t worry – your site shouldn’t experience any downtime during the switch.

Once you’ve updated your nameservers, your site should be fully set up with CloudFlare. But because you’re using WordPress, you can take one more step to get even more control over CloudFlare.

Step 5: Install the CloudFlare WordPress Plugin

This plugin isn’t required to use CloudFlare with WordPress, but it does give you more control over how CloudFlare functions. It also gives you the ability to manually purge CloudFlare’s cache of your site, which can come in handy.

To get started, install the plugin. Once you activate it, you’ll need to log in by entering both your CloudFlare account email address and your API key:

Enter account and API key

To find your API key, go to the My Account section at CloudFlare’s website. Then scroll down to API Key and click View API Key for the Global API Key row:

View API

Once you enter the API key into the WordPress plugin, you should be able to control parts of CloudFlare from your WordPress dashboard:

Control CloudFlare from WP Dashboard

Is it Worth Paying for Premium CloudFlare?

For the vast majority of WordPress sites, the free version of CloudFlare should be totally fine. But there are a few benefits to CloudFlare’s premium plans which might entice you to upgrade.

First, you get access to CloudFlare’s Polish image optimization. It offers two types of image compression:

  • Lossless
  • Lossy

While there are plenty of free WordPress image optimization plugins, they typically have limited feature sets.

With premium plans, you also get more page rules. While that may not seem intriguing to beginners, if you’re an advanced user, these give you much more control over how CloudFlare handles caching, redirects, and more.

If you’re using CloudFlare with WooCommerce, these page rules are essential to ensuring dynamic shopping carts and other features function properly.

Finally, premium CloudFlare gives you access to more detailed analytics. You can learn more about bandwidth usage, threats, and other data.

Wrapping Things Up

When you consider the value you get for your money (can’t beat free!), CloudFlare is almost a no-brainer. While there are certainly other affordable CDNs, few are as easy to set up as CloudFlare. Nor do most other CDNs offer the security boosts included with CloudFlare.

Set up is quick and painless. So if you’re not already using a CDN, there’s really no reason not to boost your page speeds and harden your site’s security with CloudFlare.

This post may contain affiliate links, which means Nimbus Themes may receive compensation if you make a purchase using these links.

Written exclusively for

Nimbus Themes Publishing Logo

About the Author

Colin Newcomer is a freelance blogger for hire with a background in SEO and affiliate marketing. He helps clients grow their web visibility by writing primarily about digital marketing, WordPress, and B2B topics.

Read all posts


  1. edalat Avatar


    February 22, 2017 at 5:46 pm

    i am using cloudflare in wordpress and really suggest you to try it. because it increases security and speed and makes your website more lovely.

    • Colin Newcomer Avatar

      Colin Newcomer

      February 23, 2017 at 11:24 pm

      Hey Edalat, I agree 🙂 It’s definitely one of the niftiest free tools you’ll find for WordPress.


Leave a Reply

Your email address will not be published. Required fields are marked *