Re-import nodes daily using feeds and hook_cron My requirement is to import nodes daily night after deleting all the contents in that node type.

I enabled the cron settings in feeds module as 1 day and tried to write hook_cron() to delete all nodes.

function my_module_cron() {
  $results = db_select('node', 'n')
              -&gt;fields('n', array('nid'))
              -&gt;condition('type', 'ars', '=')
              -&gt;execute()
              -&gt;fetchCol();
  if (!empty($results)) {
    node_delete_multiple($results);
  }
}


But the doesn't seems to be deleted. I think this might be because of the user access problem. 

I also want to know will the delete occurs before re-importing. How to order the cron jobs or shall I run the import via code after deleting the nodes.
There is no need to do that manually. 

Under Settings for Node Processor just select Replace Existing Nodes.

For further details you can check https://www.ostraining.com/blog/drupal/feeds/ which explains the steps in detail.

There is a field called GUID. Make sure that you set it to an appropriate value so that nodes will be updated(deleted and reimported). If the GUID in your site matches to that of the import then current nodes will be deleted(irrespective of whether they were created manually or imported) and the nodes from your news source will be reimported.