Here is the situation: I would like to conditionally filter the value of a field depending on user role.
I can use the acf/filter_value filter to solve most of my problem, except in cases where $format_value = false.
In those cases, acf/load_value looked like it would be the solution, however it has two shortcomings:
- acf/load_value is not called every time. If the field has been cached and retrieved with wp_cache_get() at the beginning of the acf_get_value() function, the acf/load_value filters will never be triggered
- Even if acf/load_value was triggered every time, any modifications I make to the value on this filter will be cached, which could lead to the wrong user roles seeing the modified version.
So in summary, there is no way to modify the returned value of a get_field() call which has $format_value = false.
Thanks for the feature request.
I have passed on this information to the plugin author and hopefully this will be addressed in a future update.