I am trying to update an advanced custom fields user field but it doesn’t work ie: the value is not updated. I get no error either. It is a dropdown/select field. Not sure if this makes a difference.
$email = $_POST['email'];
$user_data = get_user_by('email', $email);
$user_id = $user_data->ID;
update_field( 'location', $_POST['current_country'], 'user_'.$user_id );
// I also tried with field key
//update_field( 'field_5fb3785065726', $_POST['current_country'], 'user_'.$user_id );
If the ACF field does not already exist, i.e. you are updating a field that previously has no value, then you need to use the field key. See the doc here https://www.advancedcustomfields.com/resources/update_field/
If the ACF field does not already exist, i.e. you are updating a field that previously has no value, then you need to use the field key. See the doc here https://www.advancedcustomfields.com/resources/update_field/ five nights at freddy’s
Thanks man. That is what I was needing