Mobile-Detect
Mobile-Detect copied to clipboard
Wordpress with W3 Caching- Does not work
Hi,
Thanks for this great plugin.
I'm using wordpress (4.2.x).
This is my functions.php:
add_action ( 'init', 'mobile_redirect' ); function mobile_redirect() { if ( is_page( 'Download' )) { require_once( get_template_directory() . '/mobile_detect/Mobile_Detect.php'); if ( class_exists( 'Mobile_Detect' ) ) { $detect = new Mobile_Detect; if ( $detect->isiOS() ) { wp_redirect( 'https://itunes.apple.com/au/app/stashd/id714814803?mt=8'); exit(0); } } } }
If I have W3 Caching turned on, the plugin works a few times, then stops working. Any work around on this? It's the most popular caching mechanism.
Is there any work-around?
Caching in WP is on the list to investigate.
Hi there,
Any idea when Mobile Detect could work with WordPress's Caching? It's horrible to have to chose one or the other!
Cheers, Chris
Depends on what your using it for. I'm using it for redirects. I seem to be able to get around cacheing by using the template_redirect hook, like so:
add_action('template_redirect', 'split_test', 999);
Though I would have to more thoroughly investigate my caching settings for W3TC
Im having this issue also except with cloudflare.