get_fields('options');in a hook on load. Instead of having to call get_field for every option, I could just access this global. I mean, I knew globals were frowned upon but it seemed to make my life easier.
However, I was making 50+ unnecessary queries! It gets every single option, even those that are within groupings or repeater fields, by itself. So it would make 10 calls for one field grouping, but that field grouping only required calling the initial field.
In this example below, I am making one call to grab three fields that are grouping the admin. If I used get_fields, I’d be making at least 3!
$colors = get_field('color', 'options); $background = $colors['background_field']; $primary_color = $colors['primary_color'];