Ready to get started?Download WordPress


WP Mobile Detector Mobile Plugin
[resolved] W3 Total Cache & Mobile Detector (7 posts)

  1. Revery123
    Posted 1 year ago #

    With the latest update of W3 Total Cache, it broke the mobile detection (probably page caching issues).

    I found a great post of how to fix it written by the author of this plugin: http://websitez.com/how-to-get-w3-total-cache-mobile-plugins-to-work/

    However, their link is broken to the function that needs to be changed in W3 Total Cache: http://snipplr.com/view/70071/wp-mobile-detector--0928/

    Anyone know what the snippet is that replaces group_verifier()? Or can the Author of this plugin provide the snippet?


  2. websitezcom
    Plugin Author

    Posted 1 year ago #

    So sorry about that, it was viewable by me because I was logged into the website but it was actually marked private.

    You should be able to view it now.

  3. Revery123
    Posted 1 year ago #

    The snippet still doesn't show

  4. websitezcom
    Plugin Author

    Posted 1 year ago #

    Hm, it keeps reverting it to private. Not sure why.

    function group_verifier($group_compare_value) {
    if(function_exists('websitez_get_mobile_device')){ //Check to see if the WP Mobile Detector is installed
    $mobile_device = websitez_get_mobile_device(); //Returns an array with mobile detection values
    if(is_array($mobile_device) && $mobile_device['type'] == "1" || is_array($mobile_device) && $mobile_device['type'] == "2"){
    return true;
    } //End WP Mobile Detector hook

    return isset($_SERVER['HTTP_USER_AGENT']) && preg_match('~' . $group_compare_value . '~i', $_SERVER['HTTP_USER_AGENT']);

  5. Andrew W
    Posted 12 months ago #

    Hi websitezcom -- any idea if this code should still be working with W3TC version 0.9.3? I'm not having any luck.

    My scenario is: I'm swapping logos inside header.php, one for desktop/tablet, the other for mobile.

    The mobile one is inside if(wpmd_is_phone()) { html code etc. }, while the desktop/table one is inside if(wpmd_is_notphone()) { html code etc. }.

    I'm replacing the original group verifier function in mobile.php with your code above, but the cache still seems to be winning. (I'm doing all the necessary W3TC and browser cache clearing in between tries.)

    Am I perhaps using the right code in the wrong way?

  6. Andrew W
    Posted 12 months ago #

    Still curious about the answer but for now I've compromised and kept the same logo with a bit of @media'ing going on to size and position it correctly for mobile.

  7. igilbeys
    Posted 11 months ago #

    Check your W3 Total Cache settings:

    In WordPress admin, go to Performance-> Page Cache -> Advanced -> Never cache the following pages.

    Add mobile-detect\.php

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic