WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hey I'm new to WordPress. I've looked at the codex and other topics here, I just don't get how to display my custom field, which I have set in the area under my post editor. The name is MyField and the value This is my custom post text.

Now I want to include my field into the category loop, so it shows up instead of the standard excerpt.

<?php the_meta(); ?> shows obviously all custom fields, that is not what I want.

I´ve tried to include <?php get_post_custom_values('MyField'); ?>, which changed nothing, do I have to do something with this after that like calling it? How can I do that?

share|improve this question
up vote 0 down vote accepted

Use: get_post_meta():

if ( get_post_meta( $post->ID, 'MyField', $single=true ) ) {
    echo get_post_meta( $post->ID, 'MyField', $single=true );
share|improve this answer
thank you! worked – Marc Ster Nov 23 '13 at 8:13

Hope below will help For user meta:

  $user_id = 9;
  $key = 'last_name';
  $single = true;
  $user_last = get_user_meta( $user_id, $key, $single ); 
  echo '<p>The '. $key . ' value for user id ' . $user_id . ' is: ' . $user_last . '</p>'; 

For Post meta:

$key_1_value = get_post_meta( get_the_ID(), 'key_1', true );
// check if the custom field has a value
if( ! empty( $key_1_value ) ) {
  echo $key_1_value;
share|improve this answer
thank you for your help i´ll give this a try, too. – Marc Ster Nov 23 '13 at 8:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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