The Ideal WP Rocket Settings With Cloudflare/StackPath CDN Instructions


If you chose WP Rocket to make your WordPress site load faster, you made the best choice, considering it was rated the #1 cache plugin in many Facebook polls.

WP Rocket comes with many features most cache plugins don’t. That means if you were to use most other cache plugins, you would need to install about 6 extra plugins. If you’re like me, you only want to use 1 plugin. This is why WP Rocket yields better scores + load times in GTmetrix/Pingdom (it has more features, while reducing the number of plugins on your site).

  • Database cleanup (built-in to WP Rocket, or use WP-Optimize)
  • Heartbeat control (built-in to WP Rocket, or use Heartbeat Control)
  • Lazy load images/videos (built-in to WP Rocket, or use WP YouTube Lyte)
  • Host Google Analytics locally (built-in to WP Rocket, or use CAOS For Analytics)
  • Host Google Fonts locally (built-in to WP Rocket, or use CAOS For Fonts, or SHGF)
  • Integration with Cloudflare + other CDNs (built-in to WP Rocket, or use CDN Enabler)

I tested WP Rocket against 3 top free cache plugins and while they all do a great job, WP Rocket gave me the best results in Pingdom (.4s load times). Your cache plugin and hosting are 2 main speed factors so it’s definitely worth the $49. Configuring the right WP Rocket settings with Cloudflare + StackPath can fix over 20 items in Pingdom and GTmetrix. So let’s do that 🙂

The WP Rocket settings are WAY easier to configure than W3 Total Cache and they update the changelog regularly so you’ll actually get ongoing updates. If you have questions (or want to share your new load time), drop me a comment. WP Rocket also has documentation which I reference throughout the guide. Good luck – remember to benchmark those Pingdom scores!

If you haven’t bought WP Rocket yet,  WP Rocket = #1 Rated Cache Plugin


1. WP Rocket = #1 Rated Cache Plugin

Here are the Facebook polls:

2016 best cache plugin poll
2019 cache plugin poll
Swift vs WP Rocket
2016 cache plugin poll
Best cache plugins 2018 poll
wp rocket vs w3 totla cache

Had to throw this in here 🙂


It has way more features than most cache plugins, so you only need to use 1 single plugin.


I tested WP Rocket, WP Fastest Cache, and W3 Total Cache… making sure all cache plugin settings were configured optimally. WP Rocket won BUT this with the lazy load feature turned ON. The other cache plugins do not have a lazy load option and when I turned lazy load off in WP Rocket, I got a .5s load time… the exact same as WP Fastest Cache. I didn’t see a huge difference when clicking through my pages – both loaded super quickly. I know Pingdom can show different load times during different tests, but I just wanted to share my own experience.

Pingdom Page Speed Test

WP Rocket (.406)

WP Fastest Cache Load Times

WP Fastest Cache (.527)

W3 Total Cache Load Times

W3 Total Cache (.619)

My latest Pingdom report with WP Rocket…


2. Install WP Rocket

Once you purchase WP Rocket you can download it on your account page. Upload it under Plugins → Add New → Upload Plugin. If you’re having issues on Safari see their instructions.

WordPress Plugin Upload

3. Dashboard


Rocket Tester – beta testing for new releases.

Rocket Analytics – lets WP Rocket collect data anonymously. This has minimal affect on load times/CPU, but sending data to any external resource means more work for your server.

Clear Cache – do this when you’re dong configuring the WP Rocket settings.

Preload Cache – generates a cache for your homepage and all internal links you use on the homepage. I don’t do this since I have preload set to “automatic” in the preload tab.

Purge OPcache – purges the OPcahce which prevents issues when you update WP Rocket, but it’s still displaying the previous version in the WordPress admin.

Regenerate Critical CSS – do this when you make changes to stylesheets, or add/modify custom CSS via the WordPress Customizer (or a plugin).

4. Cache


Mobile Cache – enable caching for mobile devices, but only “create a caching file for mobile visitors” if you are NOT using a plugin to create a mobile site (eg. free version of WP Touch).

Enable Caching For Logged-in WordPress Users – enable if multiple users are logging into your site (eg. bbPress). This gives each user their own cache, otherwise disable it.

Specify Time After Which The Global Cache Is Cleared – leave as the default. If you rarely update your site or have a lot of static content, you can increase this a bit.

5. File Optimization


Minify Files – ideally these should make all “minify” and “combining” items in your Pingdom and GTmetrix report 99 – 100%. Sometimes enabling these can cause issues with your layout (especially CSS and JS) so check a few pages on your site to make sure this doesn’t happen. If it does, find the problematic files and add them to either the exclude CSS or exclude JS option.

Combine Files – just like minify, enable and check your site for errors.

Combine Google Font Files – Google Fonts are often shown in Pingdom/GTmetrix report. This can help, and you can also trying adding them in “Prefetch DNS Requests” in the Preload tab.

Remove Query Strings From Static Resources – In GTmetix you might see “remove query strings from static resources.” This can help, however most query strings are generated by plugins – expand your items in GTmetrix and see what is making it red – it could be a plugin.

Exclude CSS – if for some reason a minification option messes up your site layout, locate the problematic file and add it here. See WP Rocket’s article on resolving issues with minification.

Optimize CSS Delivery – your page will start loading without CSS styles which is an item in Google PageSpeed Insights. WP Rocket automatically generates this for you. They say

When you activate the Optimize CSS delivery setting checkbox, CSS will be loaded asynchronously on your site. Additionally, Critical Path CSS will be generated for your website in the background and added upon the next page load.

JavaScript Files – same concept as CSS only with JavaScript files.

6. Media


Lazy Load – delays loading of images, iframes, and videos until you scroll down the page and they become visible (test to see if you like it or not). This significantly reduces load times and HTTP requests however the ongoing loading can be annoying especially for long content. This can also be done using other free plugins like Lazy Load and Lazy Load For Videos but WP Rocket does a great job. I have it lazy load for photos since it’s annoying.

You can also disable lazy load on individual pages/posts using the sidebar:

WP Rocket Individual Settings

Disable Emojis – these slow down your site. You can also disable these under Settings → Writing → Formatting, then do not convert emoticons.

Embeds – similar to Cloudflare’s hotlink prevention, this prevents sites from embedding your content on their website which sucks up bandwidth and makes your site slower.

7. Preload

If you want to learn about preloading, WP Rocket has a simple tutorial. Or if you want to dig deeper here is an advanced tutorial which is about WP Super Cache but the same concepts apply. Preload, in somewhat simple terms, is a refresh when the cached pages are all cleared out and refreshed in one go. I would enable it since it improves both website/indexing speed.


Sitemap Preloading – extends the benefit of preload to ALL URLs in your sitemap, not just your homepage and the internal links you use on the homepage. This does not use an external bot like the manual/automatic option… even if the end result is the same. As long as WP Rocket detected your sitemap in “sitemaps for preloading,” there is no need to add it here.

This is what preloading can do for your server…

CPU Usage

Prefetch DNS Requests – Luke made an great list of common domains to prefetch including Google Fonts, Analytics, Maps, Gravatars, YouTube, common social sharing plugins, Disqus, and others. Copy and paste this entire list (or just the ones you need) and paste them into the Prefetch field of WP Rocket. This helps browsers anticipate the requests and load them faster.


view rawDNS Prefetch domains hosted with ❤ by GitHub

Don’t forget to add your StackPath CDN URL (or whatever CDN you’re using), and other external resources not included in this list, which you can usually find in your GTmetrix report. Social sharing, comment, and statistic plugins are very common.

8. Advanced Rules

The advanced options are mainly for excluding cart and checkout pages in eCommerce sites.


Never Cache URL(s) – if you’re using an eCommerce shopping cart not listed by WP Rocket (see the note they have in this settings), add your cart and checkout pages here. Learn more.

Never Cache Cookies – same principal as previous option only based on cookies.

Never Cache User Agent(s) – prevents Googlebot or other user agents from caching pages.

Always Purge URL(s) – let’s say you have a blogroll on your homepage. If you create a new post, you want that homepage blogroll updated immediately by emptying the homepage cache. That’s what this setting does, however WP Rocket automatically clears the cache for your homepage, categories and tags once new content is created… so there is no need for this. But if there are other page’s cache you want cleared when new content is added, add them.

Cache Query String(s) – mainly used to cache search result pages and price filtering pages for eCommerce sites.

9. Database


Post Cleanup – revisions, auto drafts, and trashed posts can be deleted if you don’t use them. Unless you have old versions of posts (or deleted posts) you would like to use, delete them.

Comments Cleanup – spam and trashed comments can be deleted.

Transients Cleanup – stores data that takes a long time to get (like social counts) so the next time you need it, it returns super fast. But sometimes when transients get expired they stay in the database and should be deleted. WP Beginner has a great explanation of transients.

Database Cleanup – when you delete a plugin it can leave unused tables in your WordPress database, which you can delete.

Automatic Cleanup – schedule WP Rocket to cleanup your database. Weekly is good unless these accumulate quickly (eg. many people work on your site). If you have WP-Optimize or another database cleanup plugin installed, you can delete it since WP Rocket does this for you.

Optimize – click the optimize button when you’re done, just be sure to backup your database especially if it’s your first time doing this.

10. CDN

StackPath’s CDN mirrors your site on 30+ data centers across the US and globe, reducing the geographical distance between your server and visitors. Using StackPath and Cloudflare is recommended, as more data centers = faster content delivery. This can shave multiple seconds off your load time especially for visitors who (used to be) far away from your 1 origin server. If you’re using another CDN, want tips on using a CDN with an SSL, or for troubleshooting, see WP Rocket’s CDN tutorials. You can use StackPath’s tutorial but here’s exactly what to do…

Step 1: Sign up for StackPath using a 30-day trial to get access to their data centers…


Step 2: In the dashboard, click the CDN tab, then proceed to create a StackPath CDN Site


Step 3: Copy CDN URL from StackPath and paste into WP Rocket’s “CDN CNAME(s)” field…


Step 4: In StackPath go to CDN → Cache Settings, then click “Purge Everything”…


Step 5: Exclude Files From CDN – ​there may be files being served by the CDN you would like to serve locally. Usually these files are parts of plugins designed to disregard cross domain load. To change this, simply add these files or directories into the “rejected files” area of WP Rocket (add one filedirectory per line) which you can use directives to locate WP directories.


  • {uploads_dir}/wpcf7_captcha/*
  • {uploads_dir}/imagerotator.swf
  • {plugins_dir}/wp-fb-autoconnect/facebook-platform/channel.html

Step 6: Run your site in GTmetrix and “content delivery network” should be green in YSlow.

CDN GTmetrix YSlow

If you expand items in GTmetrix and see it has to do with your CDN, contact StackPath’s support team who should be able to help you fix these. They have outstanding support.

Cookie Free Domains MaxCDN

11. Heartbeat

You used to need a separate heartbeat control plugin. Now WP Rocket has it built-in!


12. Add-Ons


1Google Tracking (Improve Browser Caching For Google Analytics) – you may see Google Analytics errors in your speed testing tool. Having WP Rocket host Google Analytics locally should fix these, specifically in GTmetrix under Page Speed → Leverage Browser Caching.

2Facebook Pixel (Improve Browser Caching For Facebook Pixel) – same concept as previous option only for Facebook Pixel.

3Cloudflare – sign up for Cloudflare, add your website, and Cloudflare will run a scan. You will eventually come to a page with your Cloudflare name servers and a link to your API key…


Change name servers in your hosting account to the ones Cloudflare assigned you…


Enter your Global API Key (found in your Cloudflare profile) into your cache plugin…

Cloudflare Global API Key
  • Global API Key – used to activate Cloudflare in WP Rocket.
  • Account Email – same email used in your Cloudflare account.
  • Domain –
  • Development Mode – use when making a lot of code changes to your site.
  • Optimal Settings – activates optimal Cloudflare settings: minification, aggressive caching, and deactivates Rocket Loader for better compatibility. Most common issue is Rocket Loader, but I also noticed it turns on email decoding which made my GTmetrix report worse, so I don’t use this (and instead configured Cloudflare in their dashboard).
  • Relative Protocol – sometimes if people download files from your site, there are no contents in them. Leaving this option OFF will prevent this from happening.
  • Clear All Cloudflare Cache Files – do this after you’re done configuring WP Rocket.

4Synchronize Sucuri Cache – enable if using Sucuri. This will automatically clear Sucuri’s cache whenever you clear WP Rocket’s cache, keeping your content syncronized.

  • Sucuri Firewall API Key (For Plugin) – login to Sucuri here, click your site, go to the API tab, then copy your API Key (For Plugin) and paste it into WP Rocket.

13. Tools


Export Settings – export your settings to use on multiple sites.

Import Settings – import your pre-configured settings here.

Rollback – if you update to a new version of WP Rocket and it causes issues, this will fall back on the previous version.

14. FAQs / Documentation

I spent many hours digging through their documentation to make sure this tutorial uses the best WP Rocket settings, but they are extremely helpful if you haven’t checked them out…

WP Rocket Documentation

Tutorials I found the most helpful:

15. Why I Use SiteGround

Join the WordPress Hosting and WordPress Speed Up Facebook Group to see what real, unbiased people are saying, since hosting is the #1 factor in the WordPress optimization guide.

I use SiteGround and have 200ms response times with 100% GTmetrix scores and .4s Pingdom load times. Do a hosting check, run your own tests, or click through my fast loading pages. They were rated the #1 host in 26 Facebook polls and are worlds better than EIG (BluehostHostGator), Godaddy, and other hosts who pack too many people on the same server. There have been plenty of people who migrated and posted results on Facebook and TwitterTweetafter tweetpost after postpoll after poll after poll, faster hosting will fix slow response times. They’re recommended by WordPress, do free migrations, and I use their semi-dedicated plan.

View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
Bluehost vs HostGator vs SiteGround
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
View Poll or Screenshot
Bluehost vs SiteGround
WordPress Web Host Poll
View Poll or Screenshot

People usually migrate because their speed technology can improve server response times by multiple seconds. Here are a few people who migrated to SiteGround and posted their results.

Switching To SiteGround
SiteGround Load Time Migration
Bluehost to SiteGround GTmetrix
HostGator To SiteGround
SiteGround GTmetrix
SiteGround Google PageSpeed Insights
100 Perfect Score On SiteGround
SiteGround Genesis
Speed Delivered By SiteGround
SiteGround GTmetrix Report
Reduced Load Times With SiteGround
New SiteGround Response Times
HostGator To SiteGround Migration
SiteGround Response Times On Joomla
Switched To SiteGround Hosting
SiteGround Rocket Imagify Combo
Joomla GTmetrix On SiteGround
SiteGround PageSpeed Insights
SiteGround On Joomla
SiteGround Reduced Load Times
SiteGround Speedy Hosting
New Pingdom Results On SiteGround
New SiteGround Response Time
SiteGround Response Time Improvement

I use SiteGround because…

  1. My GTmetrix + Pingdom report speak for themselves
  2. They use PHP 7.3, NGINX, HTTP/2, Cloudflare, fast speed technology
  3. Average load time is 1.3s, giving most people instant speed improvements
  4. They’re recommended by WordPress and Ivica from WordPress Speed Up
  5. Free Let’s Encrypt SSL, easy to use cPanel, and features for eCommerce
  6. Renewal prices are a price jump, but you can get 3 years of the promo price
  7. Always been known for great support (tickets usually answered in <10 min)
  8. I always get 100% uptimes but 99.99% is guaranteed (includes daily backups)
  9. They do free migrations, have a migrator plugin, and 30-day money back policy
  10. They’re based in Chicago (my hometown) and have 4 data centers to choose

They have 3 plans:


Higher plans include more server resources (#1 factor in the WordPress optimization guide). Here’s the full comparison chart, but GrowBig gives you about 2x more server resources than StartUp, and GoGeek is semi-dedicated hosting which gives you even more. GrowBig and up comes with a free migration, staging, advanced caching, and ability to host multiple websites. GoGeek comes with priority support. Their cloud hosting is quite the price jump at $80/month.

You can see this on their features page


One of many threads…


16. My Full WordPress Speed Guide (35+ Tips)

AMP (Accelerated Mobile Pages) – AMP is a Google project that makes mobile pages load faster and gives you a nice AMP stamp by your mobile search results. You will use the AMP plugin (in conjunction with Yoast’s Glue for Yoast SEO & AMP plugin). The AMP plugin actually adds the AMP, Glue for Yoast lets you customize how your mobile pages look (to a certain extent). Once installed you can add /amp/ to any page on your site to see how it looks on mobile. This process hasn’t been perfected yet, but this is the best way that I know of so far. And yes, you should check out my Yoast tutorial which has been used by over 75,000 people.

Yoast AMP Pages

Image Optimization – you can run any page through GTmetrix and it will show you all unoptimized images but ONLY for that page – so start with the ones that appear on multiple pages. Image can be optimized 3 ways: serve scaled images (resizing images that are too large), specifying image dimensions (adding a width/height in the image’s HTML or CSS), and optimize images (losslessly compressing them using a plugin like Imagify). GTmetrix will tell you the correct dimensions for the first two if you expand them, and these are all high priority items.

Image Optimization

For more tips, see my complete guide to WordPress speed optimization.

17. Get Help From My WordPress Speed Optimizer

Still need help with your GTmetrix/Pingdom report? I’ve been working with Pronaya for 7 years (he’s the one who helped me get a <1s load time in Pingdom). You can hire him by creating a profile on and searching for username bdkamol. Here is his full WordPress speed portfolio. He’s $40/hour from Bangladesh (so there is a time change) and you can email him at [email protected]. He also has a perfect 5 star review on his profile. Serious inquiries only, and please don’t expect 100% scores if you’re using slow hosting, a bloated theme, and tons of heavy plugins. Please follow my full WordPress speed guide first.


Here are some reviews on his profile…


So… how are those Pingdom scores looking? Let me know in the comments or tell me if you’re stuck. You also paid for a premium plugin where they offer support (the last and final tab in the WP Rocket settings), so I would use that to your advantage too, or view their documentation.

Otherwise, nice job!

If you found this tutorial helpful, a share is always appreciated 🙂


About the author


Add comment

Recent Posts