Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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


share|improve this question

1 Answer 1

up vote 4 down vote accepted
preg_replace("~^(?:f|ht)tps?://~i", '', $url);

Replaces http https and FTP in string $url

share|improve this answer
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
@ChristopherDavis Brilliant! Thank you! – AHCo Dec 18 '11 at 23:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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