Forums

[resolved] Understanding get_post_meta & single (6 posts)

  1. davidn.de
    Member
    Posted 11 months ago #

    get_post_meta does not act as the reference (http://codex.wordpress.org/Function_Reference/get_post_meta) is telling me:

    The $single parameter acts the opposite as statet. If I set it to TRUE and I expect the value to be an array, I receive an array, if I set it to FALSE, there is something empty beeing returned.

    Actually I might be ment the other way arround. Nevertheles it is strange...

  2. esmi
    Theme Diva & Forum Moderator
    Posted 11 months ago #

    If I set it to TRUE and I expect the value to be an array

    Wrong. Note the third parameter: $single.
    If you want only a single value returned, use TRUE, else use FALSE for an array of values.

  3. davidn.de
    Member
    Posted 11 months ago #

    Don't get it. I store an php array with update_post_meta and I want to get an array back. Then I have to use TRUE, eventhoug

    use FALSE for an array
    ...
    What array is meant?

  4. esmi
    Theme Diva & Forum Moderator
    Posted 11 months ago #

    Have a look at http://codex.wordpress.org/Function_Reference/post_meta_Function_Examples It might explain it better than I could in English :-)

  5. davidn.de
    Member
    Posted 11 months ago #

    Now I get it. There can be several values stored for the same postid AND key. Thank you!

  6. esmi
    Theme Diva & Forum Moderator
    Posted 11 months ago #

    Glad I could help :-)

Reply

You must log in to post.

About this Topic