Wrong display for mobile, tablet or desktop

If you have issues with the mobile version of your site being shown to desktop users, or vice versa, make sure you have enabled the option to create a separate cache file for mobile devices. This is found on the Cache tab of the WP Rocket settings:

Now, for every page, you will have a cache file that will be shown to desktop users, and a separate file that will be served to mobile users.

Which device types does WP Rocket consider “mobile”?
Mobile Caching

Additional cache layers

If you are using another layer of caching on your site, such as Varnish, NGINX, Cloudflare's Cache Everything etc, you have to ensure that this other cache layer is configured to distinguish between mobile and desktop visitors.

Wrong display for tablet users

WP Rocket's mobile detection treats tablets as desktop, not mobile devices by default.

Since there can only be two versions of the cache—desktop and mobile—if you have a specific display for tablets only, it's not possible to have a third cache file for that view. 

However, you can modify this default behavior to serve the tablet version as mobile with the below helper plugin:

📥 Download (.zip): WP Rocket | Set Tablets As Mobile
Developers: you can find the code for this plugin on GitHub.

The helper is useful if your theme or plugin uses the wp_is_mobile function, which treats tablets as mobile devices. Please note that both the option to Enable caching for mobile devices and sub-option Separate cache files for mobile devices must be enabled for the helper to work.

Alternatively, you can exclude those devices from the cache, based on the user agent. 

In WP Rocket's Advanced Rules tab, locate the field labeled “Never cache (user agents) and add the following list (one per line): 

iPad
NexusTablet
SamsungTablet
HPTablet
AsusTablet
BlackBerryTablet
HTCtablet
MotorolaTablet
AcerTablet
ToshibaTablet
LGTablet
FujitsuTablet
LenovoTablet
DellTablet
SonyTablet
PhilipsTablet
HuaweiTablet
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.