Add a filter to my view before executing
Another way is to add the filter as an exposed filter in the view and then set it programmatically like this:

// Set created date range filter.
$item = $view-&gt;get_item($display_id, 'filter', 'created');
$item['value']['min'] = $settings['min'];
$item['value']['max'] = $settings['max'];
// Disable exposed filter in UI, for programmatic filter.
$item['exposed'] = FALSE;  
$view-&gt;set_item($display_id, 'filter', 'created', $item);


That should come before $view-&gt;pre_execute();

You can also add a completely new filter in a similar way, by building up a valid $item to use with $view-&gt;set_item.