2

Ok guys... I'm sure this is going to be a really easy answer. I'm a complete noob at this.

I have a custom field that is supposed to return a link. For some reason, it just redirects me back to my site homepage. I'm really new to Wordpress so I'm not sure what's going on but I've scoured Google and this is what I've got:

 href="<?php get_post_meta(get_the_id(), 'ramco-videos-link', true);

Why won't it return the link in the custom field?

  • 1
    get_post_meta won't print anything. Use echo get_post_meta. – тнє Sufi Jun 5 '14 at 17:10
3

get_post_meta() only returns the output, but does not print it. You have to use either echo or the_meta() to print the actual output.

 href="<?php echo get_post_meta(get_the_id(), 'ramco-videos-link', true);
1

Try this:

<?php echo get_post_meta($post->ID, 'ramco-videos-link', true); ?>

Make sure you have the closing PHP tag in there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.