Mobile Caching

In this article

What does “mobile” mean for WP Rocket?

Usually the term “mobile device” would be used for smartphones as well as tablets, and every screen size in between. WP Rocket, however, applies the term “mobile” to phones only. It does not consider tablets as “mobile” in the context of page caching. Mobile phones get detected by HTTP user agent. 

Only phones, not tablets are treated as “mobile” by WP Rocket.
If you’re down with code, look at wp-rocket/inc/front/process.php around line #138 for the complete set of user agents WP Rocket will detect.

Should I enable caching for mobile devices?

Yes, as a rule of thumb, you should enable caching for mobile devices.

Don't enable mobile caching if your website is not responsive, i.e. does not adapt to and fit onto smaller screens automatically.

Note: If no mobile cache option is enabled, WP Rocket will not serve any cached documents to mobile devices. Visitors viewing your website on their phone will receive (slower) page views directly from the WordPress database.

What does “Create a caching file for mobile visitors” mean?

When this option is enabled, WP Rocket will create a dedicated cache file for mobile devices for every document that gets cached. As a result, WP Rocket will serve an entirely different cache file to mobile phones than to tablets, or desktop computers.

This can be useful, or even necessary in case your site provides any features for mobile devices only, such as an additional navigational toolbar loaded via JavaScript. If WP Rocket would not create a dedicated file for that view, those mobile features could get cached and be visible on desktop devices as well—or the other way round: the desktop view would get cached and served to mobile devices as well, hence no mobile features would be visible.

If you use any of the following plugins, this option will be enabled by default (and you will see the checkbox in the settings "grayed out") :

Note: Dedicated mobile caching files have been introduced in WP Rocket 2.7. If you run a previous version and use any of the plugins mentioned above, you should not enable mobile caching.

If you visit the cache directory in wp-content/cache/wp-rocket/[] (with representing your domain), you will see 2 types of file names for each document:

  • index.html(.gz) —cache files for tablets and desktop 
  • index-mobile.html(.gz) —cache files for phones

Should I enable both mobile caching options?

Depending on how responsive your design is, you would either just enable the first option, or both options in case your site provides any features loaded only on mobile devices. 

Here’s a good rule of thumb on how to use these 2 options:

Use the first option (Enable caching for mobile devices) alone if your design is fully responsive and scales up and down seamlessly.
🛠  WP Rocket will serve the same cache file for a page request that a tablet or desktop computer would receive.
Additionally enable the second option (Create a caching file for mobile visitors) in case you use one of the plugins mentioned above or in the option’s description, or in case your site loads any resources on mobile devices only.
🛠  WP Rocket will serve a separate cache file to phones, different to the one tablets and desktop computers would receive.

Not sure what to do? 😰
When in doubt, always enable both options. This can result in twice as many cache files on your server, but it will in any case fit your needs, no matter how responsive your site is exactly.