Inserting URL from Custom Field
-
I’m trying to insert a unique(to each post) URL at the end of each post. The URL is stored in a custom field. I have tried the following:
<?php $link = get_post_meta($post->ID, 'custom_field_name', true); if ($link){ echo '<a href="'.$link .'">Visit this site.</a>'; } ?>
and
<a href="<?php echo get_post_meta($post->ID, "custom_field_name", true); ?>">Visit this site.</a>
Both of these codes have resulted in the URL being displayed with my domain attached to the beginning so it looks like:
https://www.mydomain42342.com/www.thedomaininthecustomfield.com/news/topic.html
Instead of the intended:
www.thedomaininthecustomfield.com/news/topic.html
How do I fix this?
Thanks!
Elijah
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Inserting URL from Custom Field’ is closed to new replies.