I'm wondering how I can detect if the user is on a localhost.
My reason for doing so is so that I can automatically run production code on a live server, but uncompressed code on my machine, without having to change the link all the time.
I know I can do it in JS like this... if(document.URL.indexOf("localhost:8888") <= 0){
But I need to do it in Php for my WordPress installation. I've come across a similar question here - How can I detect if the user is on localhost in PHP?
So I tried this (below), but it fails to load anything
<?php if(IPAddress::In(array("127.0.0.1","::1"))) { ?>
<script src="<?php bloginfo('template_url'); ?>/js/scripts.js"></script>
<?php } ?>
I've also tried the suggested solution here, but again, doesn't work for me How can I detect if the user is on localhost in PHP?
In case these details help, I'm using MAMP on Mac, with a WordPress installation.