How to add value in to multiple value field (entity reference)? Im inserting into user field reference to other users. This is my code, but it is overiding all values of field, i just want too add value and keep values added before.

&lt;?php 
global $user;

$user-&gt;field_profile_access['und'][]['target_id'] = 34;
user_save($user)


?&gt;
I think this line is wrong:

$user-&gt;field_profile_access['und'][]['target_id'] = 34;


You could try with:

$user-&gt;field_profile_access['und'][] = array('target_id' =&gt; 34);


or this:

$next = count($user-&gt;field_profile_access[LANGUAGE_NONE]);
$user-&gt;field_profile_access[LANGUAGE_NONE][$next]['target_id'] = 34;


I used LANGUAGE_NONE instead of 'und' here, but that's not the problem.

Or even better, using the Entity API. That example is for a field collection, but the idea should be useful for any entity, including nodes.