using: Advanced Custom Fields PRO – Version 5.8.11
been trying to find a hook where I can apply this solution but I need a little direction.
I am trying to set a rule where, Whenever I use a clone field it would get
saved with the parent field label (not part of it and not manually.
I would like to write the solution and tested some filters but
I guess I am targeting the wrong ones.
the clone fields I am using across (multiple) sites cant have a “one label fits all”…
it’s bad for the client and doesn’t convey the use in relation to the section
At the frontend.
Is there any filter I can use to save that field (Relative to each location)
with the parent label as its label? something I can use to create as a global solution?
& much love
You cannot change where ACF save the value.
You could possibly use acf/prepear_field to alter the label shown to the user based on where it is being shown https://www.advancedcustomfields.com/resources/acf-prepare_field/
I would love to do that (only change the display) – that’s even easier.
However… as it seems (example: https://pastebin.com/Bw1dBbAt)
the information meaning the original field label isn’t included in the
cloned field data. is there another hook/filter way to do this?
If you think about it
making a global field which u can use across page templates / locations
needs a ‘relative to location’ title… so this is not a weird idea.
$parent = get_field_object($field['parent']);
$label = $parent['label'];