Skip to content

Instantly share code, notes, and snippets.

@gmutschler
Last active August 29, 2015 14:05
Show Gist options
  • Save gmutschler/95647230aab3dbf79de3 to your computer and use it in GitHub Desktop.
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)
<?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