Mobile-Detect icon indicating copy to clipboard operation
Mobile-Detect copied to clipboard

Wordpress with W3 Caching- Does not work

Open yarnball opened this issue 9 years ago • 4 comments

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?

yarnball avatar Sep 15 '15 23:09 yarnball

Caching in WP is on the list to investigate.

nicktacular avatar Sep 16 '15 19:09 nicktacular

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

chrisbfi avatar Jan 03 '17 14:01 chrisbfi

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

djarrin avatar Jan 03 '17 15:01 djarrin

Im having this issue also except with cloudflare.

cworf avatar Jun 12 '17 16:06 cworf