Forums

Meta Data displays with 'the_meta();' but not with get_post_meta! (4 posts)

  1. Stumpfarmer
    Member
    Posted 1 year ago #

    I am able to display the bulleted list of all of my posts' metadata with the basic

    <?php the_meta(); ?>

    tag in the loop with no problem, but when I try to display a single key's value with

    <?php $client = get_post_meta($post->ID, ‘client’, $single = false); ?> <p>Client:<?php echo $client; ?></p>

    I get a null return. I am able to be sure I have the correct key name and that that key has a value becuase I can see it right there in the <?php the_meta(); ?> output.

    Would love to resolve this- I wasn't able to find anything like this by searching the forum or Google.

    Ak!

  2. Stumpfarmer
    Member
    Posted 1 year ago #

    Note that $single = true does not work either- that was just a test...

  3. migbrasil
    Member
    Posted 10 months ago #

    <?php $client = get_post_meta($post->ID, 'client', false); ?>
    <?php echo($client) ?>

    ;)

  4. Jaaaarne
    Member
    Posted 7 months ago #

    Thank you, migbrasil! I had the same problem and it worked beautifully for me. Only I had to make it "true", not "false".

Topic Closed

This topic has been closed to new replies.

About this Topic