p tag added when using href with variable
-
Hello,
I’m trying to add an external link to a page but wordpress adds a <p> before and after the url so my link is part of the self site url.
I get an external url (ex:
https://www.myurl.com
) from a field (ex:field_3008) in the database:
$myurl = apply_filters(‘the_content’, $this->myplugin[‘current’][‘data’][field_3008]);then when using:
<a href="<?php echo $myurl; ?>">mylink</a>
I’m expecting the link to be: ‘https://www.myurl.com’ but I get
https://www.mywordpress_site.com/myurl.com
I tried the following:
<a href="//<?php echo $myurl; ?>">mylink</a>
but it doesn’t work.
I realized that wordpress adds <p> before and afterhttps://www.myurl.com
Any idea of how to make it work?Thank you!
- The topic ‘p tag added when using href with variable’ is closed to new replies.