Skip to content

Passing the Google mobile friendly test with WPTouch and WPEngine

Preparing for Google’s Mobile Friendly update (opens in a new tab) on April 21st, we noticed that some of our clients’ sites using the WPTouch plugin (opens in a new tab) were unexpectedly failing Google’s mobile-friendly test (opens in a new tab).  Since all of the sites were hosted with WPEngine (opens in a new tab), we contacted both WPTouch and WPEngine support. After a bit of back and forth, WPEngine solved the problem by adding the following to the varnish cache for the affected sites.

set $mobile_bot 'no';
if ($http_user_agent ~* (iPhone) ) {
	set $mobile_bot "X";
}
if ($http_user_agent ~* (Googlebot) ) {
	set $mobile_bot "${mobile_bot}Y";
}
if ($mobile_bot = "XY"){
	set $is_bot 0;
}

If you’re having a similar problem passing the mobile friendly test and use WPTouch and WPEngine, try it out!

Categories: Resources
A black silhouette of a frog viewed from above, showing its outstretched legs and toes.
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognizing you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Please visit our privacy policy for more information regarding the personally identifiable information we collect and how it is used.