Last active
August 29, 2015 14:05
-
-
Save gmutschler/95647230aab3dbf79de3 to your computer and use it in GitHub Desktop.
return the TLD and Domain on any Wordpress install. (Usefull for mailer for example)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function domain_url() { | |
//get the full domain | |
$urlparts = parse_url(site_url()); | |
$domain = $urlparts [host]; | |
//get the TLD and domain | |
$domainparts = explode(".", $domain); | |
$domain = $domainparts[count($domainparts)-2] . "." . $domainparts[count($domainparts)-1]; | |
return $domain; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment