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 have to know the field key, you cannot get the field key by using the field name if that field does not have a value for the post, even if you use
acf_get_field(). In this case your line $field = acf_get_field( ‘assignment_approved_by’ );
In addition to this an ACF field stores the User ID in the database for a user field and not the users display name. The user ID is the value you need to use in the update.
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’re reaching out to our multilingual users to ask for help in translating ACF 6.1. Help make sure the latest features are available in your language here: https://t.co/TkEc2Exd6U— Advanced Custom Fields (@wp_acf) May 22, 2023
© 2023 Advanced Custom Fields.