I have written a nice little plugin to translate fields (300 lines of code) that I use in my projects now.
I use two hooks to save/load fields in different languages:
add_filter('acf/load_value', __NAMESPACE__.'\load_acf_values', 10, 3);
add_filter('acf/update_value', __NAMESPACE__.'\update_acf_values', 10, 3);
I currently translate all fields in all groups, however there are cases when I wouldn’t want to translate fields ( page settings, email addresses …) so I am working on the option to exclude specific acf groups from translation.
The function hooked to acf/load_value retrieves 3 variables ( $value, $post_id, $field )
I’m specifically interested in the $field->parent as it should contain the acf group
Unfortunately, what I’m experiencing is, that for some fields $field->parent is 0.
Reasons I can exclude so far:
– Only Options Page fields don’t carry the parent (is not the case)
– Depends on the hook where the fields get added ( all on the acf/init hook)
If you have any ideas what else could be the reason, please let me know.