Delete field content using entity metadata wrapper

Public

To delete a field content using entity metadata wrappers, just set it to NULL explicitly. No matter what type of field it is.

</> CopyGet raw version
php
  1. $wrapper = entity_metadata_wrapper('node', $node);
  2. $wrapper->field_myfield->set(NULL);
  3. $wrapper->save();

Comments

Anonymous's picture

This does not work with entity references...