How to Set Up W3 Total Cache with WPtouch Plugin on WordPress


Like many problems with this site, I prefer to fix things when I cannot afford to ignore them any longer or the solution presents itself to me with little effort on my part. One of these growing problems that I chose to neglect showed up again recently when Eric from FWebDe sent me a reply via Twitter.

@loneplacebo Hey man, I’m stuck with the mobile theme on your site!

Of course, failing to properly identify the issue at hand like the great minds at BP, I sent him a reply soon after explaining:

In the moments that followed, I realized that Eric was not referring to the fact that my site’s theme wasn’t working properly for mobile users, but that desktop users were seeing the mobile theme instead.

Hallelujah! Time to fix this once and for all! Right? Ok, maybe later. So, I told Eric:

@FWebDe that sometimes happens. Stupid wptouch iPhone theme plugin. Shrug.

But as fate had known, Brave New Code, the fine creators behind the WPtouch iPhone Theme plugin, noticed my ill-conceived tweet and proceeded to file a defamation lawsuit against me seeking $100 billion dollars due to loss revenue. In other words, they wanted me to get off my lazy ass, stop making negative comments about their plugin, and finally attempt to fix this issue.

Ah ha! I exclaimed as the magical light bulb that shows up in moments of sheer brilliance appeared above my head. I’ve been pointing my finger at the wrong guy the whole time! “Stupid W3 Total Cache plugin!” I tweeted away moments later.

So, what exactly is the big issue?

With caching plugins like W3 Total Cache or WP Super Cache installed on your WordPress blog, most of your pages are cached by the plugin so that subsequent visits to your site by visitors will be a much smoother and faster process. Sounds good so far? Good, then let’s continue.

Then, there came the mobile users. Say what?! People can visit your site on their phones now?! No way!!

Yes, way. Since mobile phone browsers are not as fast as their desktop counterparts, it became crucial for website owners to offer mobile themes of their site for mobile visitors. In other words, we needed a plugin like WPtouch since most of us are too damn lazy to create a mobile theme from scratch.

Once installed, however, your mobile theme plugin may not exactly follow a peaceful symbiotic relationship with your caching plugin. As mentioned earlier, problems occur when your caching plugins are not configured properly to incorporate the mobile theme plugin. For example:

  • Mobile theme showing up for desktop users.
  • Desktop theme showing up for mobile users.
  • John McCain joining Twitter.
  • Toddlers listening to Justin Bieber.

So, as you can see, we got some issues at hand.

Before we start…

If you are running the WP Super Cache, the fine people at Brave New Code created a video on how you can configure the plugin to work properly with WPtouch:

Step 1 of 4:

Copy and paste the following list of mobile user agents into the Rejected User Agents list found in the Page Cache Settings section of your W3 Total Cache settings(the list that already includes bot, spider, crawl, etc):

android
blackberry9500
blackberry9530
cupcake
dream
incognito
iphone
ipod
mini
webOS
webmate
2.0 MMP
240×320
ASUS
AU-MIC
Alcatel
Amoi
Audiovox
AvantGo
BenQ
Bird
BlackBerry
Blazer
CDM
Cellphone
DDIPOCKET
Danger
DoCoMo
Elaine/3.0
Ericsson
EudoraWeb
Fly
HP.iPAQ
Haier
Huawei
IEMobile
J-PHONE
KDDI
KONKA
KWC
KYOCERA/WX310K
LG
LG/U990
Lenovo
MIDP-2.0
MMEF20
MOT-V
MobilePhone
Motorola
NEWGEN
NetFront
Newt
Nintendo Wii
Nitro
Nokia
Novarra
O2
Opera Mini
Opera.Mobi
PANTECH
PDXGW
PG
PPC
PT
Palm
Panasonic
Philips
Playstation Portable
ProxiNet
Proxinet
Qtek
SCH
SEC
SGH
SHARP-TQ-GX10
SIE
SPH
Sagem
Samsung
Sanyo
Sendo
Sharp
Small
Smartphone
SoftBank
SonyEricsson
Symbian
Symbian OS
SymbianOS
TS21i-10
Toshiba
Treo
UP.Browser
UP.Link
UTS
Vertu
WILLCOME
WinWAP
Windows CE
Windows.CE
Xda
ZTE
dopod
hiptop
htc
i-mobile
nokia
portalmmm
vodafone

The highlighted items above are found in the list of user agents in the WPtouch Advanced Options section(screenshot below; click image to enlarge). The remaining list is the mobile user agents in the second to last section of the W3 Total Cache Page Cache Settings page with Android, iPhone, and iPod removed since it was already in the WPtouch user agents list.

Don't act like you can't find it!

Thoroughly confused? I sure hope not.

Step 2 of 4:

As mentioned above, the Mobile user agents found in the W3 Total Cache Page Cache Settings page should look like this:

android
blackberry9500
blackberry9530
cupcake
dream
incognito
iphone
ipod
mini
webOS
webmate
2.0 MMP
240×320
ASUS
AU-MIC
Alcatel
Amoi
Audiovox
AvantGo
BenQ
Bird
BlackBerry
Blazer
CDM
Cellphone
DDIPOCKET
Danger
DoCoMo
Elaine/3.0
Ericsson
EudoraWeb
Fly
HP.iPAQ
Haier
Huawei
IEMobile
J-PHONE
KDDI
KONKA
KWC
KYOCERA/WX310K
LG
LG/U990
Lenovo
MIDP-2.0
MMEF20
MOT-V
MobilePhone
Motorola
NEWGEN
NetFront
Newt
Nintendo Wii
Nitro
Nokia
Novarra
O2
Opera Mini
Opera.Mobi
PANTECH
PDXGW
PG
PPC
PT
Palm
Panasonic
Philips
Playstation Portable
ProxiNet
Proxinet
Qtek
SCH
SEC
SGH
SHARP-TQ-GX10
SIE
SPH
Sagem
Samsung
Sanyo
Sendo
Sharp
Small
Smartphone
SoftBank
SonyEricsson
Symbian
Symbian OS
SymbianOS
TS21i-10
Toshiba
Treo
UP.Browser
UP.Link
UTS
Vertu
WILLCOME
WinWAP
Windows CE
Windows.CE
Xda
ZTE
dopod
hiptop
htc
i-mobile
nokia
portalmmm
vodafone

This list is almost identical to the rejected user agents list with only the default list of rejected user agents excluded. Simply replace the the Mobile user agents list with the list shown above.

Step 3 of 4:

We’re almost near the end, young Anakin. Now, copy your rejected user agents list that you’ve already pasted in the W3 Total Cache Page Cache Settings and paste it into the same rejected user agents list found in the Minify and CDN Settings sections.

Step 4 of 4:

Now, all you have to do is clear the stored cache. Simply go to the General Settings page of W3 Total Cache and click on the “empty all caches” button found at the top of the page.

Well, that wasn’t too hard right?

Lastly, if you’re like me and had problems with WPtouch outputting the desktop theme on mobile phones, you whip out your shiny new iPhone 4 or Android and check out your site’s homepage. If the mobile theme is not being rendered, then feel free to contact me and bitch me out for my awful job writing this tutorial.

For more related information, check out this useful thread at the WordPress forums.

  • Pingback: How to Set Up W3 Total Cache with WPtouch Plugin on WordPress — Mobile Wikipedia

  • http://fwebde.com/ Eric B.

    Good to see you’ve got that all sorted out now :)

    • http://loneplacebo.com/about Tony Hue

      I couldn’t have done it without you, Eric!

  • http://www.websitebegin.com Joe Boyle

    Great post, and perfect timing, too!

    I was wondering how I could add the WPtouch plugin (for when I’m on the go), but not disable W3Total Cache! Thanks for the wonderful tutorial that will make my blog look so much better for mobile people.

    • http://loneplacebo.com/about Tony Hue

      Music to my eyes, Joe. :)

  • vipan

    great post

    • http://loneplacebo.com/about Tony Hue

      Gracias, Señor Vipan!

  • kyocera

    Thanks … Was stuck at one point.

    Thanks for the links and the write up!

  • http://www.bdtechie.com Nasif

    Thanks a lot tony..Do I need to put bot, spider, crawl in the rejected user agents lists ? sorry for my ignorance !

    • http://loneplacebo.com/about Tony Hue

      Yes, that is correct.

  • Pants

    Not working. Followed the same instructions laid out on 3 different sites, Mobile theme used to appear on iPhone before making the changes, now only desktop theme appears on iPhone.

    • http://loneplacebo.com/about Tony Hue

      Didya empty the cache saved by W3 Total Cache?

  • Pants

    Yes I did…I emptied page cache in page settings then all caches in general settings. No luck so far. Just giving up at this point…

  • Pingback: Nightmares With W3 Total Cache and Wp Touch ! | BDTECHIE

  • http://www.navodayas.com ankit

    my account is suspended due to overloading then how can i get out from this error using w3 caches.

  • http://www.ipodrepublic.com Daniel

    I have followed all the guides on this issue to the point, but every time i activate my wptouch pro plugin it causes 500 errors across the site.

    Are there any specific settings that need to be applied in other areas of w3 total cache for it to work? could it be other plugins that causes the issue? could there be setting errors on my server causing it?

    Getting the same error as well when using super cache with wptouch pro.

    Appreciate any help on this issue before i test using a combo of hyper cache and wp minify instead.

  • AutoPersonality

    Thank you very much.

    Had several issues with configuring the two to work together and since their tutorials had broken links this was of great help.

  • http://techtwisted.com/ Twisted Tech

    What the Hell This Means ”
    The remaining list is the mobile user agents in the second to last section of the W3 Total Cache Page Cache Settings page with Android, iPhone, and iPod removed since it was already in the WPtouch user agents list.”

  • http://twitter.com/nicolasforcet Nicolas Forcet

    Everything is working now, thanks to you ! Clear explanations, tanks.

  • http://lasvegasworldnews.com/ Chellie Cervone

    I cannot tell you how frustrated I am. After someone views site on mobile, the desktop then sees mobile so I followed other instructions and it crashed my site. Then I found your instructions. As soon as I pasted the list in the rejected user agents (step 1), my site crashed again. I had copied all of my w3tc files so I put them back and my site is now up (not hours like last time) but it will just not work for me. i really like w3tc but I think I am going to have to find an alternative so that I can have a mobile site

    Also, your list 1 and list 2 are exactly the same. I pasted both in notepad and compared line by line.

    So I guess I just don’t understand the instructions, they are so not clear

    Step 1 says to paste the list and I pasted the list, could not even get to step 2 because site crashed.

    You even say what the list should look like and repeat the exact same list and then you say mobile user agents – they rejected one?

    Instructions are not clear. Super frustrating.

    I don’t how the other folks here followed them or perhaps some of the information got taken out.

    • http://loneplacebo.com/ Tony Hue

      Hi Chellie. Sorry about the frustration. I wrote this post a long time ago and since then, I’ve switched back to WP Super Cache because of how bloated W3 Total Cache had become. It’s great for messing with all the finer details of caching on your website, but sometimes the effort isn’t worth the benefit.

      I would recommend switching to WP Super Cache. Fewer configurations to mess with, fewer opportunities for confusion. Works fine with WPTouch for me. I currently use both plugins on this blog.

      Hope that helps!

      • http://lasvegasworldnews.com/ Chellie Cervone

        I did keep it on the site I was writing about but on a new site I tried Super Cache and really like it. It’s easy. Thanks again.

  • http://funwidtricks.com/ Vinay

    Wow worked great! I was configuring only on page cache section but later reading your post i came to know that should include UA’s in Minify and CDN sections!