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?


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

Replaces http https and FTP in string $url

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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