I have done quite a bit of googling and it's possible my wording is not providing the correct results.
Issues I have faced are when I go to the wp-admin to login I get redirected to new url since i am technically viewing the website with desktop browser. so I need to exclude all the admin/dashboard/all the pages that one uses to build a wordpress site.
Also have received this "Warning: Cannot modify header information - headers already sent by" quite a bit. I would share what I have tried but I have changed code so much that I deleted it all so my site would work again for now.
Thank you in advance for any assistance.
It depends on how you're handling the redirect, but:
// Redirect condition
if (!is_admin()) {
if (!wp_is_mobile()) {
// If not using mobile
wp_redirect('https://your_desktop_site.com');
exit;
}
}
With regards to the errors you're seeing: again, this is going to be down to how you're handling the redirect. However you're assessing the condition to determine what platform they're browsing on, you should probably hook in pretty early, for example on init
, template_redirect
or wp
.