Hi Danny,
sorry for continuing this thread – I think it is indeed related to my initial question.
And the plugins I found did not help in this specific case.
I’ll try to explain.
Koko uses an url for standalone view: https://YOUR-DOMAIN/?koko-analytics-dashboard=1
This is a useful option which can be viewed (or not) publicly.
It would be nice to have an option to restrict the viewing to my own IP-address.
So my question was: would this be possible?
On Stackexchange I found the following code (but I’m afraid it only works for pages, not for a query like your settings page url):
function page_ip_restriction() {
if(is_page('yourpage'))
{
// Whitelist
$whitelist = array(
'x.x.x.x',
);
// Check if current user IP is out of the whitelist, then redirect to home
if(!in_array($_SERVER['REMOTE_ADDR'], $whitelist))
{
wp_redirect(home_url(), 403); // 403 -> Forbiden access
exit();
}
}
}
add_action('init', 'page_ip_restriction', 10);
Maybe this illustrates what I’m looking for.
Hope it’s not too much of a hassle ;-(
Thanks again!