Hi Andrew990,
You can try something like this:
1. Go to your theme’s folder. (i.e. /wp-content/themes/”yourthemename”)
2. Now try to find out which file of your current running theme is common to all pages. (note: Generally it may be footer.php, header.php etc. It is depending on your installed theme.)
3. Now add these lines of code in that file within <script></script> tag.
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
window.location.href ='http://www.example.com'; //paste the URL of the page from your website instead of http://www.example.com
}
4. Feel free to let me know if this works for you or not.
Regards,
Debabrata
user wp function
https://codex.wordpress.org/Function_Reference/wp_is_mobile
<?php
if ( wp_is_mobile() ) {
//wp_redirect( $location, $status );
wp_redirect( home_url() ); exit;
}
?>