You can use this function to redirect a mobile user to a different homepage in Wordpress. In practice you would probably want to use a more robust user agent sniffer than the is_mobile()
function shown here, such as Mobile Detect.
This code assumes you are using a static page with an ID of 1 for the homepage. If you are using the blog index for your homepage, replace !is_page(1)
with !is_home()
.
If you wanted to not redirect but fetch a different page, you should be able to modify the query_vars on $query, but I haven't tried that.