Hide or prevent views from rendering on a page

Warning message

JQuery Cycle must be installed in order to run the slideshow. Please go to Status Report for instructions.

Primary tabs

To hide the views on a page programatically, you have to use hook_views_pre_view. This is useful when you have same view rendering on a page more than one time and you have to hide one of the display mode. For example, it might be possible that your page is rendering a view and a block of a view . Then you might want to hide that view and display a block only.

 * Implementation of hook_views_pre_view().
function YOUR_MODULE_NAME_views_pre_view(&$view, &$display_id, &$args) {
  //Check the view name and display mode of view, then hide the view.
 // Display id is the machine name of the view or block inside a view
   if ($view->name == 'view_machine_name' && $display_id == 'document_page') {
		$view->executed = TRUE;