Get domain name from URL
-
Hello!
I have a wordpress page where I use custom post fields for each post containing details of the post
(one of them is URL of the source).I call the values to the frontpage with the following code:
<?php $key = "source_url"; echo get_meta($key); ?>
I would like to get only domain from this whole URL and put the whole URL in the link.
Example: https://www.google.com/blablabla/link215616.html would be shown as google.com and on click you would be dirrected to https://www.google.com/blablabla/link215616.html.
I was looking a lot on the web and trying lots of stuff but I’m not so experienced with PHP and I have problems to figure it out.
any suggestions?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Get domain name from URL’ is closed to new replies.