I'm using drupal 7, feeds 7.x-2.0-alpha8. How to skip (don't update) some fields from existing node during import if this field already has a value?

i.e. We periodically import some products with photo (create new and update existing). After that editor can change photo. How can I skip this photo field during next update?

There is some feeds tamper plugin to check is field in updating node is empty? Maybe there is some hook from feeds or feeds tamper?

  • Maybe using custom module? Try hook_node_presave() which gives you the unchanged data and new data too. – Sumit Madan Feb 3 '15 at 11:07
  • Thank you for the answer! Is it possible to define that this node updated by feeds when hook_node_presave() executed? – Adv Feb 3 '15 at 11:51
  • Hmm!!! that you need to check. – Sumit Madan Feb 3 '15 at 12:03
  • 1
    Seems that hook_feeds_presave() is better. – Adv Feb 3 '15 at 12:28

Had the same problem. I finally used hook_feeds_presave(), and unset the field I wanted to skip. Here's the code:

function mymodule_feeds_presave (FeedsSource $source, $entity, $item, $entity_id) {
  if ($source->importer->id == 'myimporter'){
    // I check if my imported value is equal to a special marker i set
    if ($entity->my_field['und'][0]['value'] == 'MARKER') {

This automatically resets THAT FIELD ONLY. Hope this helps someone.


If you do not wants to update the previously imported feed. you can check this

enter image description here

  • Thank you for you answer! I know about this setting, but i need to skip only one field, not a whole node. – Adv Feb 3 '15 at 11:30

Skipping the whole entity item is easy by setting $entity->feeds_item->skip to TRUE.

However unsetting the selected fields could be more tricky. The workaround is to unset these fields in hook_feeds_presave, however some more complex fields may not like to be unset and can generate some unpredictable errors (e.g. field collection).

So another approach is to load the old node and override the new values with the old. Here is some mixed example of unset some fields and override another:

 * Implements hook_feeds_presave().
 * Invoked before a feed item is saved.
function hook_feeds_presave(FeedsSource $source, $entity, $item) {

  $config = $source->importer->getConfig();
  $skip = &$entity->feeds_item->skip;

  if ($entity->type == 'my_type') {
    if ($status == FOO_SKIP_IT) {
      // Don't update anything.
      $skip = TRUE;
    elseif (condition) {

      $node = node_load($entity->nid); // Load the old values.

      foreach ($entity as $key => $val) {
        // Passing system fields and additional feed fields images and price.
        if (in_array($key,
              'vid', 'uid', 'log', 'comment', 'promote', 'sticky', 'vuuid',
              'nid', 'type', 'language', 'created', 'changed', 'tnid', 'translate',
              'uuid', 'revision_timestamp', 'revision_uid', 'metatags', 'locations',
              'location', 'name', 'picture', 'data', 'num_revisions', 'current_revision_id',
              'is_current', 'is_pending', 'revision_moderation', 'date', 'revision', 'menu',
              'feeds_item', 'guid', 'field_feed_status', 'field_collection', 'field_some_complex_field',
              ))) {
        else {
          // Unsetting unnecessary fields.

      // Override values with the old one.
      $entity->field_collection = $node->field_collection;
      $entity->field_some_complex_field = $node->field_some_complex_field;

    else {
      // Otherwise update all fields.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.