Remove a contextual filter programmatically Is there a way to programmatically remove a contextual filter from a view? I have a view where, at times, I want to display it without the contextual filter active. This is the code I tried. 

function MYMODULE_views_pre_view(&amp;$view, &amp;$display_id, &amp;$args) {
  if ($view-&gt;name == 'some_view') {
    unset($view-&gt;args);
  }
}


I also tried the same code within hook_views_pre_execute().

How can I achieve this?
To remove a contextual filters just set the $args to empty array or unset the desired arguments unset($args[0]) to remove the first argument an so on:
Here is an example to remove all contextual filters:

/**
 * Implements hook_views_pre_view().
 */
function MYMODULE_views_pre_view(&amp;$view, &amp;$display_id, &amp;$args) {
  if ($view-&gt;name == 'some_view') {
    // Remove all filters.
    $args = [];
  }