Hi,
i have an ACF user field hidden, and i would like to automatically set it with the user logged value. I think i must use acf/load_value but i don’t understand how.
Thanks for help
I would use an acf/load_field filter and set the “default_value” to the logged in user.
thanks John but could give me an example please ?
https://www.advancedcustomfields.com/resources/acf-load_field/
add_filter('acf/load_field/key=field_123456', 'set_default_user', 20, 1);
function set_default_user($field) {
$field['default_value'] = get_current_user_id();
return $field;
}
Works very fine, thanks a lot !!