Is it possible to programmatically delete a display from a view?

The view object has numerous member functions related to displays (add_display, attach_displays, choose_display, set_display, new_display, etc.) and I can also disable a display like this:

  $view_name = "faq";
  $display_name = "page_1";
  $view = views_get_view($view_name);
  $view->display[$display_name]->display_options['enabled'] = FALSE;

But I can't see how I can remove the display completely. Can anyone advise? Thanks!

1 Answer 1


This is how you do it. It is how it is done in views_ui_edit_view_form_submit() when you delete a display via the admin UI:

  • I should have thought to look there. Thanks - that worked.
    – Frank H.
    Aug 11, 2015 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.