Home › Forums › General Issues › Update ACF field programatically that has not been 'initialised' › Reply To: Update ACF field programatically that has not been 'initialised'
You are doing this
$update_field($field_key, $display_name, $assignment_id);
you need to do this
$update_field($field_key, $user_id, $assignment_id);
and if your field allows multiple selections then you need to do this
$update_field($field_key, array($user_id), $assignment_id);
actually, you may need to do the second one even with only allowing a single user to be selected. I don’t remember if ACF stores an array or not for user fields that only allow one selection.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.