W3 Total Cache and WPTouch: Cooperating at last!
Most people who’ve worked with WordPress for very long know, it’s important to implement some sort of caching plugin to make their site as fast as possible. Most would also agree that it is increasingly important to make your site available to mobile users. (Hey, it’s all about making the information digestible by anyone, right?)
Well, combine two of the most popular plugins for these features, and you might find you have a bit more configuring to do.
The problem arises because W3 Total Cache will try to cache your mobile pages. This is a problem, because it doesn’t include the logic to know which user agents to supply the mobile version and which to supply the desktop version. (After all, it is not itself a “mobilizing” plugin…) The symptom is that a desktop user might get a mobile version and a mobile user might get a desktop version. (W3TC looks in its cache to see if it finds a page that resulted from a request for a certain page, finds a page at the ready, and delivers it. It doesn’t contain the logic to know that a mobile client should get the mobile version, and the desktop client should not.)
Basically, tell W3 Total Cache to completely ignore the mobile agents. This means that it won’t be delivering a cached version of the page to mobile clients, and will also never cache the mobile version of the page. (I know, this means that your mobile users are going to always have pages dynamically generated for them; there may be another way to skin this cat, but I’m not seeing it at this point, and nobody seems to be offering this as an option.)
There is an excellent explanation of this and the steps to perform to make this happen at the WordPress.org forums:
In a nutshell:
- Go to the WPTouch Settings page (Settings->WPTouch)
- Scroll down to the Advanced section (If you don’t see it, check your version. Current version as of today is 184.108.40.206. If you have version 1.9.41 read this.)
- In the Custom User-agents section, highlight and copy all of the user-agents that WPTouch is handling by default.
- Paste the list of user-agents that WPTouch is handling into the Rejected User Agents field in W3TC (Performance -> Page Cache -> Advanced -> Rejected User Agents)
- Clear all caches so everything can get set straight
These steps again in visual form:
Version Number Issues in WPTouch
If you read through these steps and thought you’d followed them pretty well, but the screenshots don’t match what you’ve got, and your site says WPTouch is up to date, you might have what I’m going to call the “sinkhole version” of WPTouch. (The name is a little mean, but I think accurate.) One of the versions of WPTouch was accidentally released with a typo in the version number. Instead of version 220.127.116.11, the version number was set as 1.9.41. (Hopefully my bolding of the last couple numbers will tell you already what the problem is…) When the PHP version_compare check is performed to find out if the version at wordpress.org is newer than the version installed, it will evaluate the numbers, determine that “41” is higher than “4.1” and decide you’re up to date.
Simply reinstall WPTouch and you should be okay. (I deleted it then reinstalled, and all of my settings were still retained.)