Support

Account

Home Forums Feature Requests filter value enhancement

Helping

filter value enhancement

  • 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:

    1. 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
    2. 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.

  • HI @mkeys,

    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.

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

The topic ‘filter value enhancement’ is closed to new replies.