Using wp_is_mobile() Together with Accelerated Domains

wp_is_mobile() is a function within WordPress for testing if the device sending the request is mobile or not. The function is simply checking if the user agent on the incoming request is a mobile user agent or not. Whilst this might be an easy fix for developers to make sure some content is only loaded on mobile, it’s not safe for caching, and it’s not responsive as responsive design means that the website changes depending on the screen size and not the device type.

This function, and other functions which changes the response based on user agent, is not safe to use together with Accelerated Domains and will result in delivering a mobile version to desktop users, and/or desktop version to mobile.