0

I have 2 custom fields in my post named Status and Version. I would like to retrieve the value of the field Status to display within the post. According to the documentation the following should retrieve the value.

<?php get_post_meta($post->ID, 'Status', true); ?>

However nothing is returned.

Doing the following

<?php the_meta(); ?>

Returns the names and values of all the custom fields, so they appear to be added correctly and working. Am I doing something wrong, or does anyone have any ideas?

Handcraftsman
  • 6,863
  • 2
  • 40
  • 33
Ben_hawk
  • 2,476
  • 7
  • 34
  • 59

1 Answers1

3

When you say "nothing is returned", what are you expecting

<?php get_post_meta($post->ID, 'Status', true); ?>

to do? get_post_meta just returns the value, it doesn't echo it, and you're not storing it in a variable. Does adding echo, like this:

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

do what you're after?

Hobo
  • 7,536
  • 5
  • 40
  • 50