Support

Account

Home Forums Feature Requests Select Boxes : Return value type

Helping

Select Boxes : Return value type

  • Hi,

    Is there any way to dynamically set the return type while calling get_field / the_field?
    e.g. Most of the times I need to display a value selected by the user. (Return type ‘Label’)
    but sometimes I need a way to fetch both Label and Value, how do I do this efficiently?

  • I don’t think that you can do this for different cases of the same field used on the same page. The only time you’d be able to alter this is when the field is loaded using an acf/load_field filter. This would effect the return value wherever the field is used after that, but you could set it dependent of a specific page, perhaps.

    The best choice would be to always return both and then use the one you need.

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

The topic ‘Select Boxes : Return value type’ is closed to new replies.