Support

Account

Home Forums General Issues Get choices from field without post_id

Helping

Get choices from field without post_id

  • How can I get all the choices from a field (to use in the front-end without using get_field_object?

    get_field_object requires at least 1 post to be matched in search to work.
    If no post matches the search query then get_field_object doesn’t return anything.

    I could pass it a $post_id manually but is there any other way which doesn’t require a post_id?

  • Hi @sil3ntone

    I believe you can do it like this:

    $field = acf_get_field('field_1234567890');

    Where ‘field_1234567890’ is the field key of your custom field.

    I hope this helps.

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

The topic ‘Get choices from field without post_id’ is closed to new replies.