So below I will explain all the details that I’m attempting to do and kind of go into detail on the setup:
Here is what I’m attempting to do:
If I make a request in the template_rewrite to /internet-explorer-11
, intercept the request, don’t load the generic page template but load in the new page-internet-explorer-11
template and show a generic die().
Once we hook into before authentication add_action('init')
(works), and you are entering the site of any url, if using Firefox, redirect to the internet-explorer-11 page with the internet-explorer-11 page template.
I don’t know if I wrote the code piece correctly, so I’m open to all the help!
I see my page template with my created page:
Here is my code attempt:
add_action('init', function() {
$firefox = strpos($_SERVER["HTTP_USER_AGENT"], 'Firefox');
if ($firefox) {
add_action('template_redirect', function() {
wp_redirect(home_url('/internet-explorer-11/'));
exit();
}, 10);
}
}, 999, 1);
How it currently works: