Can't set view title in hook_views_views_pre_view I am trying to change the title of the view based on some conditions view object. I figured that I could simply run 

drupal_set_title('New title');


from inside the hook_views_views_pre_view, but its not changing the title. I tried it in hook_views_query_alter too, but it wouldn't change. I've confirmed that its actually entering the hook by doing a printout of the view object.

Should I be able to set the title from these hooks?
It's probably the Views module is calling drupal_set_title() right after invoking those hooks, so calling drupal_set_title() in those hook doesn't have the effect you are expecting. You could eventually use view::set_title in hook_views_pre_view() or hook_views_pre_render().

function mymodule_views_pre_view(&amp;$view) {
  if ($view-&gt;name == 'the view you need to alter') {
    $view-&gt;set_title(t('New title'));
  }
}


You cannot assume those hooks are invoked when a view page is being rendered; it could be the view is embedded in a page for which the title change is not desired. This is similar as assuming hook_node_view() is being invoked when a node is rendered in its own page, and then calling drupal_goto() from that hook.