For instance, I want the 'name' field to not be in any fields and I want the 'age' field to be in the edit field but not the add field:
$crud->unset_fields('name');
$crud->unset_add_fields('age');
The actual result of this code is that 'name' is in both add and edit forms and age is not in the add forms (in other words, the first line of code is ignored).
If we switch the order the reverse happens:
$crud->unset_add_fields('age');
$crud->unset_fields('name');
'age' will be in the add form but 'name' will not be in any form (again, the first line of code is being ignored).
The workaround is to just not use unset_fields with unset_add_fields and unset_edit_fields and instead use unset_add_fields and unset_edit_fields to explicitly remove a field from both.
However, to me this is unexpected behaviour and the above code should actually work.