Ready to setup the latest, best WP Rocket settings?
- File Optimization
- Advanced Rules
- Image Optimization
If you haven’t bought WP Rocket yet, I would appreciate you using my affiliate link. I also donate a good chunk of my affiliate income to charity. You can get 10% off by going to their coupons page, sign up for their email list, and they’ll email you a coupon.
Leave both options off unless you want to be a beta tester or let WP Rocket collect your data anonymously which results in a (very small) performance decrease. I recommend BunnyCDN or Cloudflare over RocketCDN/StackPath (covered in the CDN section). You can clear the cache or regenerate critical CSS if you make design/plugin changes but they don’t appear on your site.
These are good cache settings as long as you don’t use a plugin for your mobile website and don’t allow multiple users to login to your site (i.e. bbPress). I increased cache lifespan from 10 to 24 so the cache doesn’t have to refresh as often which saves a little bit on server resources.
Mobile Cache – enables caching for mobile devices. Only enable “separate cache files for mobile devices” if you use a plugin for your mobile website (like the free version of WP Touch).
User Cache – leave disabled unless you have multiple users logging into your website (bbPress for example) where there is user-specific content. It gives each user their own cached version.
Cache Lifespan – a lower number means the cache will refresh more frequently, but it consumes more resources. A cache lifespan with a higher number means it won’t refresh as frequently, but saves resources. Do you care more about your cache building frequently or saving server resources? Since I only publish a couple posts a week, I increased it to 24 hours.
3. File Optimization
Minify CSS/JS Files – enables minification which removes whitespace from the code.
Optimize CSS Delivery – your page will start loading without CSS styles. Sometimes, this doesn’t work properly and can cause layout shifts (a worse CLS score in web vitals) and FOUC. To prevent this, try setting a fallback critical CSS using a critical CSS generator, then make sure Optimize CSS Delivery is working. If this is still causing layout shift, I would disable completely.
- Search “rocket-critical-css” in your source code to make sure it’s working.
- If it doesn’t appear, regenerate critical CSS in WP Rocket and page builders (if applicable).
- Run your site through a critical CSS generator.
- Paste CSS code in the “fallback critical CSS” field (image below).
- Disable optimize CSS delivery on individual pages/posts if needed.
- Exclude problematic files from CSS delivery using WP Rocket’s helper plugin.
Using Autoptimize With WP Rocket – I also recommend testing Autoptimize on top of WP Rocket which gives you better control of how CSS/JS files are optimized. Below are the settings I use. If you use it, some WP Rocket settings will be grayed out since Autoptimize will handle it.
addtoany cookie-law-info apps.elfsight.com/p/platform.js xfbml.customerchat.js fbevents.js fbq( /busting/facebook-tracking/ /sdk.js#xfbml feedbackcompany.com/includes/widgets/feedback-company-widget.min.js font-awesome ft.sdk.min.js getbutton.io adsbygoogle.js google-analytics.com/analytics.js ga( ' ga(' /gtag/js gtag( /gtm.js /gtm- translate.google.com/translate_a/element.js static.hotjar.com/c/hotjar- static.leadpages.net/leadbars/current/embed.js snap.licdn.com/li.lms-analytics/insight.min.js livechatinc.com/tracking.js LiveChatWidget widget.manychat.com olark //a.omappapi.com/app/js/api.min.js pinit.js pixel-caffeine/build/frontend.js shareaholic ShopifyBuy sharethis simple-share-buttons-adder smartsuppchat.com/loader.js Tawk_API widget.trustpilot.com/bootstrap static.ads-twitter.com/uwt.js twq( platform.twitter.com/widgets.js wpdiscuz
Enable everything except for WebP caching. If you’re using a WebP plugin, it will generally serve WebP images already. If you embed YouTube videos, replacing YouTube iframes with a preview image can often cut your video’s load times in half since they’re a very large element.
Lazy Load – delays loading of images, iframes, and videos until you scroll down the page and they become visible. This significantly reduces initial load times and HTTP requests, but constantly loading images as you scroll can be annoying (test it out for yourself). Always lazy load videos and replace iframes with a preview image since embedded videos are very heavy.
Pro tip on lazy loading videos in Elementor – Adam from WP Crafter made a YouTube video on using Elementor to load videos faster. When I tested it, the results were great. Not only was I able to embed videos with 0 GTmetrix errors, but I could also customize colors, play buttons, and overall branding of videos. Unfortunately my blog doesn’t use Elementor (only my pages), but I recommend following his video if yours does – especially if you see GTmetrix errors when enabling WP Rocket’s lazy loading.
Add Missing Image Dimensions – WP Rocket will add missing width + height attributes to HTML images which should fix use explicit width and height on image elements in Lighthouse.
Disable WordPress Embeds – similar to Cloudflare’s hotlink prevention, it prevents other sites from embedding your content on their site which sucks up bandwidth and stresses your server.
WebP Caching – leave disabled. WP Rocket does not create WebP images (it can only serve them) in which case your WebP plugin would already do this. Using WebP images will fix the serve images in next-gen format item in Lighthouse. They can be created using plugins like ShortPixel or WebP Converter For Media. You can convert JPEG/PNGs to WebP manually using tools such as CloudConvert, but you may run into issues on Safari. Using a plugin is safer.
Activate preloading, then preload links which loads a page in the background when users hover over a link. Prefetch DNS requests and preloading fonts are types of browser resource hints. Prefetching is done with items found in your reduce impact of third-party code Lighthouse report. Preloading can be done with fonts which you can find in your GTmetrix Waterfall chart.
Preloading – tells browsers to start fetching resources that will be needed soon.
Preload Links – according to WP Rocket’s documentation, this feature makes it so if a user hovers over, or touches, a link for 100ms or more, the HTML of that page will be fetched in the background, so that when they actually click the link, the page appears to load nearly instantly.
Prefetch DNS Requests – look at your third-party code report in Lighthouse. These can be Google Fonts, Tag Manager, AdSense, YouTube, or even Facebook/Twitter buttons or widgets.
Grab all those URLs from your report and paste them into the Prefetch DNS Requests section of WP Rocket. This will help browsers anticipate those external requests and load them faster.
//maps.googleapis.com //maps.gstatic.com //fonts.googleapis.com //fonts.gstatic.com //use.fontawesome.com //ajax.googleapis.com //apis.google.com //google-analytics.com //www.google-analytics.com //ssl.google-analytics.com //www.googletagmanager.com //www.googletagservices.com //googleads.g.doubleclick.net //adservice.google.com //pagead2.googlesyndication.com //tpc.googlesyndication.com //youtube.com //i.ytimg.com //player.vimeo.com //api.pinterest.com //assets.pinterest.com //connect.facebook.net //platform.twitter.com //syndication.twitter.com //platform.instagram.com //referrer.disqus.com //c.disquscdn.com //cdnjs.cloudflare.com //cdn.ampproject.org //pixel.wp.com //disqus.com //s.gravatar.com //0.gravatar.com //2.gravatar.com //1.gravatar.com //sitename.disqus.com //s7.addthis.com //platform.linkedin.com //w.sharethis.com //s0.wp.com //s1.wp.com //s2.wp.com //stats.wp.com //ajax.microsoft.com //ajax.aspnetcdn.com //s3.amazonaws.com //code.jquery.com //stackpath.bootstrapcdn.com //github.githubassets.com //ad.doubleclick.net //stats.g.doubleclick.net //cm.g.doubleclick.net //stats.buysellads.com //s3.buysellads.com
Preload Fonts – copy your font files from GTmetrix Waterfall (they have a tab for font files) and paste them in WP Rocket’s preload fonts field. Retest your website and they should load faster.
Preload your largest contentful paint image – WP Rocket doesn’t let you preload other files (you may see a recommendation in PSI to preload your first contentful paint image). To do this, you can add the following code to your header or use Pre* Party Resource Hints or Perfmatters.
<link rel='preload' href='https://onlinemediamasters.com/wp-content/ uploads/2020/03/about-banner.png' as='image'>
What about preconnect? – WP Rocket automatically preconnects your CDN URL (in the CNAME field of your CDN settings) and fonts.gstatic.com if you’re using a CDN URL and Google Fonts. WP Rocket does not let you add other domains to preconnect (these should be used sparingly anyway), but if you want use preconnect to establish early connections to other third-party sites, use Pre* Party Resource Hints, Perfmatters, or add this code to your header.
<link rel="preconnect," href="https://cdn.domain.com"> <link rel="preconnect," href="https://fonts.gstatic.com">
6. Advanced Rules
Advanced Rules are mainly for eCommerce sites, however WP Rocket is already compatible with most solutions like WooCommerce and BigCommerce. But if you’re having issues with cart widgets, caching, or something related to eCommerce, WP Rocket has documentation for that.
Otherwise, leave this blank.
Never Cache URLs – if you’re using an eCommerce shopping cart that is not supported by WP Rocket, add your cart and checkout pages here which will exclude these pages from the cache.
Never Cache Cookies – same principle as previous option only based on cookies.
Never Cache User Agents – prevent Googlebot or other user agents from caching pages.
Always Purge URLs – 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 usually no need for this. But if there are other page’s cache you want cleared when new content is posted, add it.
Cache Query Strings – mainly used to cache search result pages + price filters on eCommerce.
Scheduling database cleanups keeps your site and admin fast, just know what you’re deleting!
- Revisions – old versions of your posts saved when you hit “Publish.”
- Auto Drafts – automatically saved versions of your post if you don’t hit “Publish.”
- Trashed Posts – posts and drafts you deleted.
- Spam Comments – comments marked as spam.
- Trashed Comments – comments marked as trash.
- Expired Transients – transients that have expired and are still in your database.
- All Transients – stores data that takes a long time to retrieve (i.e. social counts on blogs).
- Optimize Tables – optimizes database tables to run more efficiently.
- Automatic Cleanup – how often you want WP Rocket to clean your database.
Delete Unused Plugin Tables (Not With WP Rocket) – one thing WP Rocket doesn’t do is let you go through your individual database tables and delete tables left behind by old plugins that aren’t installed anymore. I recommend installing WP-Optimize and going through your tables every so often, especially if you deleted plugins (plus it shows you the actual size of the tables). The tables that say “not installed” are the ones that were left behind by old, uninstalled plugins.
CDNs are great if you have visitors far away from your origin server. They mirror your site on multiple data centers which reduces the geographic distance between your server and visitors.
Which CDN Is Best?
- BunnyCDN – higher performance CDN highly recommended in multiple Facebook Groups (see this thread, this thread, and this thread). Instructions require creating a pull zone then copy/paste your CDN URL into WP Rocket. Or just use the BunnyCDN plugin.
- Cloudflare – free, but not a true CDN since Cloudflare doesn’t serve assets from a CDN URL. Great for small sites, however there are higher performant CDNs out there. As of writing this, their APO doesn’t work with WP Rocket. Be sure to add a cache everything page rule, enable WAF, hotlink protection, and set the browser cache expiration to 1 year.
- RocketCDN – paid CDN, easiest to setup through WP Rocket, uses StackPath’s data centers, but RocketCDN doesn’t always perform well and can actually increase TTFBs.
- Check Their Data Centers – CDNs have data centers all over the world. If one has data centers heavily concentrated in the area you want, that is something worth considering.
The CDN tab is for RocketCDN, BunnyCDN, and CDNs that use a CDN URL. It’s not for Cloudflare which requires changing nameservers then using the Cloudflare tab.
Step 1: Sign up for a CDN (BunnyCDN is solid).
Step 2: Create a pull zone and choose the locations you want.
Step 3: Copy your CDN URL.
Step 4: Paste the CDN URL in WP Rocket’s CDN CNAME(s) field.
Testing CDNs – since Cloudflare is set up differently and requires changing nameservers, the “content delivery network” in GTmetrix will still be red (but it will be green for other CDNs). That doesn’t mean Cloudflare isn’t working; use the Claire Chrome Extension to make sure it is.
Exclude Files From CDN – lets you serve files locally instead of the CDN. Usually, these files come from plugins designed to disregard cross domain load. In most cases, there is no need.
The WordPress Heartbeat API tells you when other users are editing a page/post and shows you real-time plugin notifications. You usually want to disable this completely, or at least limit it’s frequency to prevent it from consuming server resources and contributing to CPU overages.
Varnish – leave disabled unless you use Varnish. I don’t use it even though it’s available with my hosting (Cloudways). Many people say you’ll get faster speeds without Varnish which I also find true. If you decide to use Varnish, activate it in your hosting account and enable it in WP Rocket.
Cloudflare – enable if using Cloudflare.
Synchronize Sucuri Cache – enable if using Sucuri. This automatically clears Sucuri’s cache whenever you clear WP Rocket’s cache which helps keep your content synchronized. For the Sucuri Firewall API Key (For Plugin), login to Sucuri here, select your website, go to the API tab, then copy your API Key (For Plugin) and paste in WP Rocket when you expand the Sucuri field.
This section is only if you’re using Cloudflare instead of another CDN.
Sign up for Cloudflare and you will come to a page where they assign you 2 nameservers.
Change nameservers in your domain registrar to the one’s Cloudflare gave you.
Add your Cloudflare information to WP Rocket.
- Global API Key – found in your Cloudflare dashboard.
- Account Email – same email you used to sign up for Cloudflare.
- Zone ID – found in your Cloudflare dashboard.
- Domain – your website’s domain name.
- Development Mode – use when making a lot of code changes to your site.
- Optimal Settings – activates WP Rocket’s recommended Cloudflare settings: minify, aggressive caching, and deactivates Rocket Loader for better compatibility. It also turns on email decoding which may hurt your Lighthouse report since it loads an extra request. If you know what you’re doing, turn this off and configure the Cloudflare settings yourself.
- Relative Protocol – sometimes if people download files from your site, there are no contents in them. Leaving relative protocol OFF will prevent this from happening.
- Clear All Cloudflare Cache Files – do this after you’re done configuring WP Rocket.
Configure Cloudflare Settings In The Dashboard – a lot of people have been asking about Cloudflare’s dashboard and how to configure it. Here are the things I recommend you do.
- Enable Brotli (Speed Settings)
- Enable and test Railgun (Speed Settings)
- Test Rocket Loader (Speed Settings) but can often break sites
- Enable hotlink protection (Scrape Shield Settings)
- Setup page rules for WordPress (below are the top 3 I recommend)
Page Rule 1: Cache Everything And Force HTTPS – cache your website aggressively.
Page Rule 2: Secure The WordPress Admin And Bypass Cache – sets security level of the admin to high and bypasses Cloudflare’s cache in the admin, since you don’t want CDNs (or apps + performance features like Rocket Loader) running inside the admin.
Page Rule 3: Decrease Bandwidth Of WP Uploads – since the content in your WP Uploads folder does not change frequently, increasing Edge Cache TTL to a month can save on bandwidth, since the WP Uploads folder cache won’t be refreshed as often.
12. Image Optimization
WP Rocket recommends Imagify because it’s their plugin.
But even when you select lossless compression, it’s definitely not lossless and neither is ShortPixel. I used both for many months and switched to TinyPNG which I’m very happy with. The only thing about TinyPNG is it doesn’t support WebP in which case you will need a plugin like WebP Converter For Media. But I find the quality is better than Imagify or ShortPixel. Test them yourself and remember, Lighthouse uses an 85% compression level to test your images.
Import or export your WP Rocket settings, or rollback to the previous version.
Export Settings – export your settings to use on multiple sites.
Import Settings – import your pre-configured WP Rocket settings.
Rollback – if you updated WP Rocket and it caused issues, fall back to the previous version.
Enable Google Font Optimization – combines fonts into 1 single file, ensures text remains visible while loading fonts, and preconnects fonts (tells browsers you intend to load Google Fonts). Remember to prefetch and preload fonts in the Preload tab and be minimal with the number of fonts, weights, and font icons. All these have an impact on your font’s load times.
Tip For “Serving Static Assets With An Efficient Cache Policy”
If you’re using WP Rocket and see “serve static assets with an efficient cache policy” in PageSpeed Insights, this means you need to set your browser cache expiration to 180 days.
If you view the code WP Rocket adds to your .htaccess, the cache expiration for images and fonts is only 4 months (about 2 months short of Google’s 180 day requirement). If you see this recommendation in PSI, you simply need to change the expiration to 180 days (about 6 months).
Edit your .htaccess (you can use Htaccess File Editor if you don’t know how). Change the expiration from 4 months to 180 days. You may only want to do this for file types being flagged.
Remember, you can only set a browser cache expiration for resources hosted on your site (images, fonts, etc). You cannot control the browser cache expiration for third-party code.
WP Rocket = #1 Rated Cache Plugin
Check the Facebook polls and WP Rocket is usually rated the #1 cache plugins.
WP Rocket comes with many features most cache plugins don’t (see below). That means if you were to use other cache plugins, you would need to install about 5-10 extra plugins to get these features when WP Rocket already has them built-in (more features, yet less plugins on your site). That’s also why WP Rocket yields better results in Lighthouse/GTmetrix and is what I use.
WP Rocket includes:
- Database cleanup – or use WP-Optimize
- CSS/JS optimization – or use Autoptimize
- Host Google Analytics locally – or use Flying Analytics
- CDN URL integration – or use BunnyCDN / CDN Enabler
- Heartbeat control – or use Heartbeat Control / manual code
- Preload links/instant page – or use Perfmatters / Flying Pages
- Lazy load images/videos – or use Optimole / WP YouTube Lyte
- Host Facebook Pixel locally – no other plugin does this that I know
- Prefetch/preload – or use Pre* Party Resource Hints / manual code
- Font-display:swap – or use Swap Google Fonts Display / manual code
WP Rocket is #1 in most Facebook polls (click thumbnails to enlarge):
Cloudways / NameHero: Who I Recommend For Hosting
There are two hosts I generally recommend, both are very different.
My current setup is Cloudways Vultr High Frequency with WP Rocket + Cloudflare. Vultr HF uses NVME with 3+ GHz processors. My site usually has a <200ms TTFB and <1s fully loaded time in GTmetrix when testing a post with 50+ images and 500+ comments (I run about 25 plugins). Run your own test or click through my site if you want. For pure speed, Cloudways is great and offers a free migration with monthly pricing and no long contract. But you’ll need to buy WP Rocket, $1/month email hosting from Rackspace, and backups cost $0.033/GB. The dashboard isn’t as easy as cPanel, yet isn’t overly complicated either. Vultr HF starts at $13/mo, recommended if speed is your #1 priority, and they have great TrustPilot reviews. Cloudways is very popular in Facebook Groups with data centers all over the world. Read my full review here.
NameHero uses LiteSpeed servers, the LiteSpeed Cache plugin, and QUIC.cloud CDN which supports HTTP/3 + NVME on their Turbo Cloud plan for $8.38/month. I tested them in this review which also shows you how to configure LiteSpeed + QUIC for optimal load times. Once configured, a fresh Astra Starter Site went from 697ms TTFB + 2.8s fully loaded time down to 61ms TTFB + 733ms fully loaded time. Make sure LiteSpeed + QUIC are setup correctly! US-based support is A+ and arguably better than Cloudways. NameHero uses cPanel, is “easier” than Cloudways, and offers a free migration. No need to buy third-party tools like WP Rocket, email hosting, or backups since they’re built-in to NameHero, LiteSpeed, and QUIC. Their data centers are only based in the United States (MI, AZ, MO) and Netherlands. The biggest con is that you have to sign up for 1-3 years of the cheap promo price, then it renews at a higher price.
Do you want Vultr HF, WP Rocket, and Cloudflare? Or do you want a LiteSpeed server, LiteSpeed Cache, and QUIC.cloud? They’re both great setups – choose what’s best for you. NameHero is best for beginners while Cloudways is for people with some hosting experience.
Be careful with other hosting companies:
- Matthew Woodward pushes WPX but uses Kinsta on his own site.
- Darrel Wilson pushes NameHero but his GTmetrix report is a mess.
- Hostinger writes fake reviews and was banned from Facebook Groups.
- They also push SiteGround when Backlinko says their TTFB is slow (I stopped recommending them and changed my review to outline all SiteGround’s problems).
- WP Engine, Bluehost, HostGator, GoDaddy, and EIG brands are obviously not good.
The only “test” you should be concerned about is your own. Some hosts offer a free trial or have monthly pricing. Move your website, test your TTFB/response times, and go from there.
Look at people who migrated to a certain host (in this case, Cloudways) and posted their results.
Affiliate Disclaimer – yes, I’m an affiliate for Cloudways and NameHero, but I’d rather make a living referring people to better, faster hosting than other garbage out there. I try to backup recommendations with real evidence. You can see conversations in FB Groups, how Cloudways is recommended by Adam (WPCrafter), and other feedback.
FAQs / Documentation
I spent many hours digging through their documentation to make sure this tutorial uses the best WP Rocket settings, but they are still extremely helpful if you haven’t checked them out.
There are also video tutorials in the Tutorials tab to help configure your WP Rocket settings.
Tutorials I found the most helpful:
- Getting Started
- My Site Is Broken
- Hosting Compatibility
- Using WP Rocket With A CDN
- Using WP Rocket With Cloudflare
- Resolve 500 Internal Server Error
- Resolving Issues With Minification
- Using WordFence With WP Rocket
- NGINX Configuration For WP Rocket
- Using iThemes Security With WP Rocket
- How To Check If WP Rocket Is Caching Your Pages
How do I setup WP Rocket settings?
How do I use a CDN with WP Rocket?
Choose a CDN like RocketCDN (StackPath), Cloudflare, or BunnyCDN. The setup process is different for each CDN; you will either use a CDN URL or change nameservers for Cloudflare.
How do I eliminate render-blocking resources in WP Rocket?
How do I fix CLS issues in WP Rocekt?
Disabling Optimize CSS Delivery or setting a fallback critical CSS can fix CLS (cumulative layout shift) issues when using WP Rocket.
Which other speed plugins do you need besides WP Rocket?
What's the best free alternative to WP Rocket?
LiteSpeed Cache is the best free WP Rocket alternative but requires a LiteSpeed server. Otherwise, W3 Total Cache is a free alternative but is difficult to configure and you may not see the same results.
What is WP Rocket's pricing?
$49/year for 1 site, $99/year for 3 sites, and $249 for unlimited sites. You can get a 10% discount by signing up for their email list on their coupons page.
Which image optimization plugin works best with WP Rocket?
Even though WP Rocket recommends Imagify (which is owned by them), ShortPixel is a more popular image optimization plugin.
If you found this helpful, share your new Lighthouse/GTmetrix scores in the comments :)
See Also: My full WordPress speed guide (it’s good, I promise).