hook_views_pre_execute not working I want to alter the view query before rendering the view, so I use the hook_views_pre_execute. I want to add an 'WHERE' 'AND' condition clause to the query. So here is my code : 

MYMODULE_views_pre_execute(&amp;$view) {
    // some code here to get my node id to exclude
    $view-&gt;query-&gt;add_where('1', 'node.nid', $nid_exclude, '!=');
}


but it seems to me the hook not working, or I did mistake to the add_wherefunction?

UPDATE : The hook is executed but the view is not modified.
To alter query you should use hook_views_query_alter 

Sample Code using hook_views_query_alter :

function MODULE_views_query_alter(&amp;$view, &amp;$query){
switch($view -&gt; name){
    case 'products':
        if($view-&gt;current_display == 'block_1'){
            $nids = get_nid();
            $nids = !empty($nids) ? $nids : array(0);
            $query-&gt;where[1]['conditions'][2]['value'] = $nids;
            $query-&gt;where[1]['conditions'][2]['operator'] = 'IN';
        }
            break;
  }
}