Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove site url from links Wordpress

Tags:

php

wordpress

I have to display link into my website like this :

$url = 'google.com';
<a href="<?php echo $url; ?>">Check it !</a>

What I don't understand now is that, the output href is not google.com but mydomain.com/google.com.

I don't know how to resolve this issue.

like image 568
Corentin Branquet Avatar asked Feb 17 '26 15:02

Corentin Branquet


1 Answers

You need to append http:// before your url

Try below code:

 $url = 'http://www.google.com';
   <a href="<?php echo $url; ?>">Check it !</a>
like image 144
Manthan Dave Avatar answered Feb 19 '26 06:02

Manthan Dave



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!