0

In taxonomy term view I want to exclude multiple nodes based on their id.

I tried to add a new CONTEXTUAL FILTER so I can handle multiple values in my Content: ID but the problem here is that it overwrites the url taxonomy/term/%/edit.

Also I have tried to add Content: ID filter in my FILTER CRITERIA but I cannot add multple values in "Not equal" field.

How can I solve that?

  • 2
    You'd have to continually add the filter. A Contextual Filter is not what you are looking for. – Kevin Aug 21 '18 at 14:46
  • i think you should hook_view_alter – vinhdv Aug 21 '18 at 15:42
0

Add more than one ID Filter

You can simply solve it by adding as many Content: ID Filters as you need, each excluding only one node. As you already know set the Operator to Is not equal to and enter one value, then add another Content: ID Filter and so on for all the nodes you need to exlude.

Use Regular expression

Or you can use the Operator Regular expression in a single Content: ID Filter. This way you can use a regex pattern that matches all the ID numbers you want to exclude.

For example the expression (2[45]) matches two numbers, 24 and 25, so those two nodes would be filtered and shown in results.

In your case you need to exclude some numbers, so you would have to have a regex that excludes. That is a bit out of scope for this question so I won't go into it. There are online regex generators you can use to help you construct the expression, but I expect it would take some time, regex is notorious for being complex and mind-boggling.

For whole range of numbers take a look at this tool: Regex Numeric Range Generator. Don't forget you need to modify the expression to exclude the list!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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