Home Forums General Issues get_field returns $label instead of $value for some Select choices


get_field returns $label instead of $value for some Select choices

  • I have a Select field with four choices, they are paired like this:

    choice1 : Choice 1
    choice2 : Choice 2
    choice3 : Choice 3
    choice4 : Choice 4

    with a return format of ‘value’.

    I cannot figure out why choice3 is returned as the value (choice3) when I use get_field but all the others are returned as the label (Choice 1, Choice 2, etc). Any ideas?

  • I figured it out – I had originally just used single entries in the Select choices list, so they would have been like Choice 1, Choice 2, etc. These are what was saved in the database for each of the posts. I went through each post and set the choice if needed (some were incorrect) then updated each one, all sorted now.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.