Open adrianbj opened 6 months ago
$page->of(false); $page->field_name = '1234|1235'; $page->save('field_name');
won't overwrite existing entries for the field - the newly set values will be appended to existing ones. You need to do:
$page->of(false); $page->field_name = null; $page->field_name = '1234|1235'; $page->save('field_name');
or
$page->set('field_name', null); $page->setAndSave('field_name', '1234|1235');
Setting the field explicitly, rather than ->remove() and ->add() should remove all existing entries and replace with provided IDs.
->remove()
->add()
Existing selected page IDs are not automatically removed.
Short description of the issue
won't overwrite existing entries for the field - the newly set values will be appended to existing ones. You need to do:
or
Expected behavior
Setting the field explicitly, rather than
->remove()
and->add()
should remove all existing entries and replace with provided IDs.Actual behavior
Existing selected page IDs are not automatically removed.