The code snippet below compares two domain names. One domain name could point to development environment. The other domain name could be a live site on the Internet where visitors go to see the results of your hard work.
All you need to do is set the variable
$live_site_url equal to the value of where your live site is found on the Internet. For example, the variable is set to edwinvelez.net which is points the website you are looking at now which is my live site. My development site lives elsewhere which is not on the Internet for you to find.
With the ability to compare locations based upon the domain name values, I can choose to selectively run code without making changes manually.
[gist id=”622327776aaf3f2df1c8006f6fd716e8″ file=”functions.php” highlight=”11″]