[Drupal] How to exclude multiple nodes with Views in Drupal?

| | 1 min read

It is very simply to exclude single nodes using views. But In this section we are going to exclude multiple nodes using Views. Only thing you need to have is contributed module "Views".

For eg : There are three node nids 45, 78, 98 that you to exclude. So to exclude this multiple nodes on it you need you need to add is "Conceptual filter" for nid. Below is the following steps where we can exclude multiple nodes with views.

  1. Firstly in your view, you will see the 'Advanced' options on the right side. Just click on it.
  2. Now you'll see the 'Contextual Filters' options. Click on 'ADD' button.
  3. Resulting will show Add contextual filters page. Search for 'nid' in the search box filtering. You'll find 'Content: Nid' and just check the box.
  4. Just click 'Apply (all displays)' will display another page 'Configure contextual filter: Content: nid'.
  5. You'll now see 'Provide default value', click on it and enter the ID's of the nodes that you want to exclude separated by a comma like this: '45,78,98'.
  6. Finally at the bottom of this page, you'll find 'More'. Click on it.
  7. You need to just check the box 'Allow multiple values' and 'Exclude' and click on 'Apply all displays'

Just check your view, multiple nodes are now excluded. Hope this articles helps you.:-)