• Resolved ranji77

    (@ranji77)


    I am have a really strange issue with one of my custom field values. I have one set as the “site_url” that each post should link to. In my code, I have:

    <a href="<?php echo get_post_meta($post->ID, 'site_url', true); ?>"><?php echo get_post_meta($post->ID, 'site_url', true); ?></a>

    On the face of the page, it looks fine. For instance, if my site_url was set to “www.cnn.com” it would look just fine on screen AS WELL AS show up the right way when I view the source code <a href="www.cnn.com">

    BUT, the weird thing is that whenever I click on it, it adds my own site url in the front! So in this example, I’d direct to “https://mysite.com/www.cnn.com&#8221; instead of just “www.cnn.com”

    I should note, that if my custom field value has the “https://&#8221; in front, it works just fine. To me, this why it’s so puzzling…

    Can someone please solve this riddle for me? Thank you in advance!

  • The topic ‘Weird bug(?) using a URL in a custom field’ is closed to new replies.