For a work extranet website i have a website that's fully accessible on premises. The website is now also fully accessible from outside as well. There are however some level 1 nav items with sub menu items that are confidential, and should only be used within the working environment.
In php i know how to redirect website visitors to a restricted page, based on there ip address. But this is a primitive solution, that interrupts the user experience. I also rather not password protect the pages, because this would also require the user to fill in that password within the working environment.
This is the code that i used for redirecting:
<?php
if (!preg_match('/^192/', $_SERVER['REMOTE_ADDR'])) {
header('HTTP/1.1 403 Forbidden');
header('Location: notallowed.php');
exit;
}
?>
I was wondering, how can i apply this logic to the wp_nav to exclude specific menu items from the navigation?