Home Forums General Issues Retrieve choices of field


Retrieve choices of field

  • Hello everybody,

    I have a small problem.
    When retrieving choices for a certain field, normally I’d use
    get_field_object('fieldname', $post_id)

    And that works fine.
    But how would I go about retrieving options, if I don’t have a post using the field, or don’t want to hardcode an id?

    If I’m not in a post loop and don’t specify an id, I always get type=”text” and don’t get any choices.

    I need the options I specified for the field in the field group edit screen.

    For example:
    authors is a dropdown field and if used on a post, get_field_object('authors', $post_id) returns:

    'edgar' => 'Edgar Allan Poe'
    'nietzsche' => 'Friedrich Nietzsche'
    'brecht' => 'Berthold Brecht'

    now I need those options, without specifying a post_id, how to go about this?

    Thanks in advance!

Viewing 1 post (of 1 total)

The topic ‘Retrieve choices of field’ is closed to new replies.