WordPress.org

Ready to get started?Download WordPress

Forums

WP Mobile Detect
Not Working with W3TC (9 posts)

  1. Mike
    Member
    Posted 7 months ago #

    This plugin was working great while I was developing my site. Now that I'm ready to go live and have enabled caching with W3TC, it's no longer working. Are there some settings I should change in W3TC? Perhaps User Agent Groups or disable certain types of caching?

    http://wordpress.org/plugins/wp-mobile-detect/

  2. Mike
    Member
    Posted 7 months ago #

    I found a work-around. In W3TC under Page Cache, use the Rejected user agents field and enter all mobile user-agents. The makes the mobile-detect work, but of course it means mobile users are served non-cached (hence slower) pages. Any way around that? Sure would be nice to serve up fast, cached content to mobile users, too!

  3. robicus
    Member
    Posted 6 months ago #

    I have the same problem, Mike. Once a page is loaded on a device, that device's content is cached and served on every ensuing page view no matter what device you're using. Currently looking for a workaround that doesn't involve disabling caching entirely for mobile users. If anybody has any ideas that could help, that would be awesome!

  4. l w
    Member
    Posted 4 months ago #

    I'm having the same problem. There must be a solution. Jesse?

  5. AngeloLazzari
    Member
    Posted 4 months ago #

    Hi, i solved following the Mike workaround putting this mobile user agent in W3TC and, performance are still good.

  6. alatui
    Member
    Posted 3 months ago #

    I found a solution, follow the steps:
    1 - update the php file mobile-detect.php to the last version(see https://github.com/serbanghita/Mobile-Detect/blob/master/Mobile_Detect.php), you only have to copy and paste the code.
    2 - Edit the file wp-config.php. In my case I only want to detect if the browser is a phone or not, so if you have a different situation you'll need to change the code a little bit.
    So, before require_once(ABSPATH . 'wp-settings.php'); add the following code: http://pastebin.com/kFNx9bZe
    Change yourdomain.com to the domain of your website
    3 - Edit the W3TC php file: /plugins/w3-total-cache/lib/W3/CacheCase.php, look for the method public function get_group() and change as the following: http://pastebin.com/kU3zTiZx
    4 - At the last step you`ll have to go to W3 Total Cache Menu > User Agent Groups and create a new group named -> use_mobile_cache
    Let it enabled and the user agents field empty.

    Remember: this solution it only detect if the browser is a phone or not and the w3 total cache plugin create 2 differents cache: one for desktop and tablets and other to phones

  7. alatui
    Member
    Posted 3 months ago #

  8. Alexander Supertramp
    Member
    Posted 3 months ago #

    Hi Alatui, great fix! But I would avoid to modify core W3TC files...
    Any solution to use your get_group function outside w3tc plugin folder?

    Best way should be paste it in functions.php... any idea?

  9. alatui
    Member
    Posted 3 months ago #

    Hi Alexander,

    Unfortunately i didn't find other way to do this, i even tried to look for some hooks in w3totalcache but with no sucess.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.