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?
When you say “nothing is returned”, what are you expecting
to do?
get_post_metajust returns the value, it doesn’t echo it, and you’re not storing it in a variable. Does addingecho, like this:do what you’re after?