0

I'm using echo network_site_url(); to place the url of each site in a WordPress MultiSite installation. This outputs http://site.com/ How do I remove the http:// and trailing slash?

Thanks.

1 Answer 1

5
preg_replace("~^(?:f|ht)tps?://~i", '', $url);

Replaces http https and FTP in string $url

2
  • Thanks. Can you explain further how to implement that in my code?
    – AHCo
    Commented Dec 18, 2011 at 7:50
  • echo preg_replace("~^(?:f|ht)tps?://~i", '', network_site_url()); Commented Dec 18, 2011 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.