How to Setup CloudFlare in WordPress to improve performance and security

Tired of DDOS attacks in your site and excessive robot traffic? Want to increase performance of your site? Learn how to setup CloudFlare in WordPress!

If you feel like your website has security concerns and is slowing down occasionally, then you can use third-party services that checks for the traffic to prevent DDOS attacks.

To increase the security and performance of the site, the webmasters use CDN which redirects the traffic from their servers to your site. There are many CDN, but most of them are commercial and costs a lot.

CloudFare is one of those CDN services that is used by many webmasters and bloggers. The cool thing about it is that it offers a free basic plan which is suitable for small websites and blogs. They also offer paid plans starting with $20 per month.

In this guide, I am going to show you how to setup CloudFare in WordPress site / blog.

How to Setup CloudFare

How to Setup CloudFlare in WordPress

1) Create your CloudFare account

To setup CloudFare in your site, firstly you need to create your account on their site. The signup process should take less than a minute, just provide the basic info.

CloudFare Signup form

(Courtesy: wpbeginner)

Once you are done with the info, click “Create account now“.

2) Add a website

CloudFare Add Website

(Courtesy: wpbeginner)

Now it will tell you add a website (e.g., for which you need to provide the CDN services. You can add as many websites as you want later.

3) Wait for the CloudFare to scan your site

CloudFare Scan Screen

(Courtesy: wpbeginner)

Once you have added your website, it will wait around 60 seconds to scan the website. Note that during this time, it will play a video which will tell you how their service works. It is highly recommended to watch the video, it should take less time than scanning the site.

Once the scan is finished, click “continue” button.

4) Configure your DNS

Once the scan is completed, CloudFare will show the list of DNS they have found in your domain. The DNS records that you want to be passed through CloudFlare will have an orange cloud icon.

CloudFare DNS Screen

(Courtesy: wpbeginner)

Once you are satisfied with the DNS records, you need to click on ‘I’ve added all missing records, continue’ button to proceed with the setup.

5) Choose a plan

Just use the free plan and leave rest of the options to their default values.

CloudFare Plan Screen

(Courtesy: wpbeginner)

6) Change your nameservers to CloudFare

Depending on your host, if it provides cPanel for managing hosting / domain, then you need to click on “Domains manager” in “Domains” section.

Domain Manager in cPanel

(Courtesy: wpbeginner)

There should be a nameservers tab where you would need to check custom nameservers and enter the required nameservers found in your CloudFare account.

Namservers in cPanel

(Courtesy: wpbeginner)

It takes some times for the DNS changes to take effect, so have patience if your site doesn’t load properly.

Pros and Cons of CDN

Here I list few of the pros and cons of CDN.


  • It increases the speed with which the content is delivered to the users.
  • It boosts performance and save money (if the money can be decreased due to low speed).
  • It provide localized data centers which are closer to the user and thus result in faster downloads.


  • It costs money.
  • It adds omplexity to your deployment procedures.
  • Sometimes it considers the legitimate traffic as robot traffic.


Summing Up

In this guide, I have showed you how to setup CloudFare and the pros and cons of CDN.

Generally it is a good idea to setup CDN, because it will most likely improve the overall performance of your site, though you should first see whether your hosting server is causing the slow down.

Need additional answers to your questions? Leave the comments in the comment section below or Ask our expert! has 4,9/5 stars based upon 2513 For best hosting Reviews