--wpredis and wp_is_mobile, anyone solved it?


#1

I have just tried --wpredis with a responsive theme which I have customized with wp_is_mobile to control what element to be displayed on mobile and desktop. However, no matter how many times I flush caches, desktop version shows up on mobile and vice versa.

(I could think of using display:none; since redis caches everything, but also hoping to minimize the page size by conditional tags.)

Is there any additional steps I should take? (I haven’t find any answer yet while googling…)

And will easyengine have better support for wp_is_mobile and other mobile theme changer plugins with redis/fastcgi cache, etc?


#2

Hello, did you find any solution or workaround on this?

My best


#3

A full-page cache can only cache rendered html. If you are trying to use a PHP function like wp_is_mobile you are relying on PHP to dynamically render the page on request. That’s something pretty close to the exact opposite of a full-page cache.

I think that if you want to deliver a materially different page on mobile devices and also use full-page caching, then you have to do one of two things:

  1. Have a separate mobile site on a different domain name (eg mobile.example.com) where you have the mobile site cached separately from the full-size site (and then rely on nginx to redirect mobile browsers to the mobile domain), or…

  2. Instead of using PHP functions to determine what you are going to show on mobile, you can write javascript code that runs in the browser.


#4

Is it not possible to have a seperate mobile cache with redis? fastcgi for example allows this


#5