To set up a CDN in WordPress you need to: choose a provider, create a distribution zone, install a plugin that rewrites the URLs of your static files, and verify everything works. The entire process takes between 15 and 30 minutes.
A CDN (Content Delivery Network) replicates your images, CSS files, JavaScript, and videos across servers located in different cities around the world. When someone visits your site, they receive those files from the server closest to their location — not from your original hosting server.
Why Does Your WordPress Site Need a CDN?
Without a CDN, every visitor downloads static files directly from your hosting server. If that server is in Dallas and your visitor is in Mexico City, latency adds hundreds of milliseconds to every request.
With an active CDN you get:
- Faster load times: files are served from the Point of Presence (PoP) nearest to the user.
- Less load on your hosting: the CDN absorbs most requests for static resources.
- Higher availability: if your main server goes down, the CDN continues serving cached files.
- Better Core Web Vitals scores: metrics like LCP and TTFB improve directly.
To learn more about how these networks work, explore our web performance category.
Step 1: Choose a CDN Provider
There are free and paid options. Your choice depends on your budget and traffic volume.
| Provider | Free plan | Approx. price (paid) | Best for |
|---|---|---|---|
| Cloudflare | Yes (unlimited) | From $20 USD/mo (Pro) | Any site size |
| BunnyCDN | No (14-day trial) | From $0.01 USD/GB | E-commerce & mid-size sites |
| KeyCDN | No | From $0.04 USD/GB | High-video-traffic sites |
| AWS CloudFront | Yes (1 TB/mo first year) | Pay-per-use | Projects on AWS infrastructure |
Our recommendation: The free Cloudflare plan is enough for most sites. BunnyCDN is the best paid option for its price-to-performance ratio and its Latin American nodes.
Step 2: Create Your Account and Distribution Zone
The process varies by provider, but the conceptual steps are the same.
With Cloudflare (most common)
- Sign up at cloudflare.com and add your domain.
- Cloudflare scans your current DNS records.
- Update your domain's nameservers to the ones Cloudflare provides (done in your registrar's panel, e.g. GoDaddy, Namecheap).
- Wait between 15 minutes and 24 hours for propagation to complete.
- Once active, Cloudflare acts as a proxy and CDN automatically for static files.
With BunnyCDN
- Create an account at bunny.net.
- Go to Pull Zones and create a new zone.
- In the Origin URL field, enter your site's URL (e.g.
https://yoursite.com). - BunnyCDN will give you a CDN URL, for example:
yoursite.b-cdn.net. - Optionally, configure a custom subdomain like
cdn.yoursite.compointing with a CNAME record to that URL.
Step 3: Install and Configure the CDN Plugin in WordPress
WordPress on its own doesn't know it has a CDN. You need a plugin that rewrites the URLs of your static assets so they point to the CDN instead of your server.
Option A: W3 Total Cache (free)
- From the WordPress dashboard, go to Plugins → Add New.
- Search for W3 Total Cache and install it.
- Go to Performance → CDN.
- Check the Enable checkbox.
- For CDN type, select the one matching your provider (Generic Mirror for BunnyCDN/KeyCDN; Cloudflare has its own option).
- Enter the CDN URL (e.g.
https://cdn.yoursite.com) and save changes.
Option B: WP Rocket (paid, simpler)
- Go to WP Rocket → CDN.
- Enable the Enable Content Delivery Network option.
- Enter the CDN URL in the corresponding field.
- Save and clear the cache.
Option C: CDN Enabler (free, lightweight)
If you only need URL rewriting without other cache features, CDN Enabler by KeyCDN is the lightest plugin. Install it, enter your CDN URL, and you're done.
Step 4: Verify the CDN Is Working
Before calling the job done, confirm that the CDN is serving files correctly.
Method 1: Inspect HTTP headers
Open your browser's DevTools (F12), go to the Network tab, reload the page, and click on any image or CSS file. In the response headers you should see:
cf-cache-status: HIT(if using Cloudflare)x-bunny-cache: HIT(if using BunnyCDN)- The resource URL should point to your CDN domain, not your original server.
Method 2: GTmetrix or PageSpeed Insights
Run a test from GTmetrix selecting a server in Europe or Asia. If load time improves compared to the test without CDN, the CDN is working.
Method 3: Check the page source
Use Ctrl + U (view source) and look for an <img> tag or <link rel="stylesheet">. The URL should contain your CDN domain, not your hosting domain.
Common Mistakes When Setting Up a CDN in WordPress
- Forgetting to clear the WordPress cache: after enabling the CDN, flush the plugin cache so pages regenerate with the new URLs.
- Not excluding the admin area: the WP dashboard should never go through the CDN; most plugins exclude it by default, but verify.
- Serving mixed content (HTTP/HTTPS): if your site uses HTTPS and the CDN serves files over HTTP, browsers will block them. Make sure the CDN URL also uses HTTPS.
- Not setting the TTL (time to live): a very short TTL means the CDN doesn't cache anything useful; a very long one makes updating files difficult. A value between 7 and 30 days is reasonable for static resources.
If you'd like expert guidance on implementing a CDN for your project, the team at elenlace.com can help you choose the right architecture for your traffic and budget.
Key Takeaways
- A CDN improves load time by serving static files from servers close to the visitor.
- Cloudflare (free) and BunnyCDN (paid) are the top options for sites targeting Latin America.
- You need a plugin (W3 Total Cache, WP Rocket, or CDN Enabler) for WordPress to rewrite URLs to point to the CDN.
- Validate the setup by checking HTTP headers or running a GTmetrix test.
- Always clear your WordPress cache after enabling or changing CDN settings.
Ready to make your site faster? The team at elenlace.com handles CDN setup, caching, and every aspect of web performance so your pages load in under 2 seconds — wherever your visitors are.
FAQ
Do I need to pay for a CDN for WordPress?
Not necessarily. Cloudflare offers a free plan that includes a full CDN and is sufficient for most WordPress sites. Paid options like BunnyCDN offer more control and better performance in specific regions, but the free plan is an excellent starting point.
Does a CDN replace the WordPress cache plugin?
No, they are complementary. The cache plugin generates static HTML pages on your server to reduce PHP and database load. The CDN distributes those files (and other resources) from locations geographically close to the visitor. Using both gives the best result.
How long does it take for a CDN to go live?
It depends on the provider. Cloudflare takes between 15 minutes and 24 hours (DNS propagation). BunnyCDN and KeyCDN are nearly instant because you only need to update the CDN URL in your plugin — no nameserver change required.
Does a CDN affect my site's SEO?
Positively, not negatively. Google considers page load speed as a ranking factor. A CDN improves LCP and TTFB, two Core Web Vitals metrics Google uses to evaluate user experience. There is no penalty for using a CDN, as long as all resources are served correctly over HTTPS.
Useful resources
Other providers and guides worth comparing: