Get the tld of a WordPress site $hostname = wp_parse_url( home_url(), PHP_URL_HOST ); $tld = end( explode( '.', $hostname ) );