Support » Plugin: WP Super Cache » [Plugin: WP Super Cache] Mobile theme shows up as desktop theme

  • Resolved Chris


    Hi, thanks for the great plugin!
    I have one problem though: I use “Mobile Smart” to switch automatically between the normal and the mobile theme. There is also the option to switch manually by clicking a link. As far as I can see, it remembers the present choice by a cookie “mobile-smart-switcher”.
    Now I have this problem: Once a desktop user clicks to the mobile theme for a page that is not yet in the cache, the next desktop user will also get the mobile theme instead of the desktop theme.
    Is it possible to tell Super Cache to respect that (or any other) cookie so that for different values it offers different versions? (Or it doesn’t cache the mobile theme at all.) It would be great if this could be done already in the .htaccess file with a new RewriteCond.
    Thank you for any advice!

Viewing 5 replies - 1 through 5 (of 5 total)
  • PS: I have now experimented a bit more and added
    RewriteCond %{HTTP:Cookie} !mobile-smart-switcher=mobile [NC]
    into the .htaccess file, after the “RewriteCond %{HTTP:Cookie}” statements (there are two) in the WPSuperCache section. Apparently the mobile theme is not being cached now. 🙂 Still have to do some more testing.

    Plugin Author Donncha O Caoimh


    Look through wp-cache-phase1.php for the cookie detection code in wp_cache_get_cookies_values(). There’s a cacheaction in it where you can fire off a function that looks for the theme cookie and returns a string marking the visitor as a mobile user.
    Check out the developer documentation linked from the readme.txt/docs here for how to use the cacheaction stuff.

    I ended up with
    in the function.php of the mobile theme, seems to stop the mobile theme now from caching.
    Would be great to have a possibility in a future release to separate caching by themes.

    I think the same.

    I wrote a plugin to redirect the user to different theme (ios, android, bb, browsers) and I believe that will be great if you add different theme support.

    Thanks for all the information.
    My Blog have less than 1% of mobile users, but sometimes, the static HTML file was the mobile version of the blog, witch was served to all desktop users.

    I just added the define(‘DONOTCACHEPAGE’,’true’); in the funcions.php of my mobile theme and the problem was solved.

    But it only solve the problem in these type of cases that very few mobile users access the blog. In a heavy-traffic mobile blog, it can cause some performance problems, provided the mobile users needs to render every page as if no cache is made.

    I think the solution is to make a different static HTML file for each user agent. The caching will be done a lot of times, but will be done correctly.

    Best Regards!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: WP Super Cache] Mobile theme shows up as desktop theme’ is closed to new replies.