This question already has an answer here:

I would like to change my Views (page display) title programmatically.

For Drupal 6 I found Setting the View-Title programmatically in Views2, but it doesn't work for me.

    function mymodule_views_pre_build(&$view) {
  if ($view->name == 'view_machine_name') {
    $view->display['display_machine_name']->handler->options['title'] = 'New Display Title';

merged by kiamlaluno Jul 4 '18 at 11:12

This question was merged with Modify the page title of view and set custom title for it because it is an exact duplicate of that question.

Browse other questions tagged or ask your own question.