In the end I found the ‘data’ argument of select2 method.
So i did this:
$acf_row.find(‘[data-name=”sq_solution_features”] input[type=”hidden”]’).select2(‘data’, new_select2_data);
new_select2_data should be array of objects {id: id, name: name}
And it seems to work and persist through form submits.
My problem here is with jQuery Select2 fields, I already managed to populate the underlying regular select field, but can’t seem to trigger the change so the jQuery Select2 box acknowledges the changes.
We found the problem in the functions.php, it was an admin header jquery script that appended theme’s fields to acf boxes, that only served as placeholders.
Sorry for wasting forum space.
It turned out to be relative path for wp_insert_attachment (ended stored with duplicate ‘/wp-content/uploads/’ in path).
Why the url worked even in that condition is beyond me.