How to disable front page view programmatically?
Views are entities, so:


Load the View:

$view_id = 'content'; // Replace with the ID of the view you wish to disable.
$view = \Drupal::entityTypeManager()-&gt;getStorage('view')-&gt;load($view_id);

Update the status:

$view-&gt;setStatus(FALSE);

And save it:

$view-&gt;save();



Or all in one go:

\Drupal::entityTypeManager()-&gt;getStorage('view')
  -&gt;load($view_id)
  -&gt;setStatus(FALSE)
  -&gt;save();