I have a Content Type named "Match" which has a local and visitor. Both are node references to a Content Type named "Team".

In Views I need to ask for matches of a specific team, no matter if that team is the local or the visitor. In contextual filters I can set a value for "local" and for the "visitor" each one in particular. So I guess I need an OR condition in this case.

Does anyone know how to solve that problem?

Edit: I found Views Contextual Filters OR module already but that's the problem, my website is too big and currently in production so we don't want to have problems because of bugs or something.

  • Re "we don't want to have problems because of bugs or something": You don't deploy directly on a production server, even for code you wrote.
    – apaderno
    Jul 10, 2015 at 5:16
  • Are you using GIT on your production website? Oct 29, 2015 at 9:24
  • FYI, duplicate question and code based answer here: stackoverflow.com/q/13531828/763010 Mar 12, 2019 at 16:43

1 Answer 1


Drupal 7:

If using D7, then consider module Views Contextual Filters OR (which only has a dev version today). Excerpt from its project page:

... provides a views plugin which modify query to support OR conditions for contextual filters.

A few issues on Drupal.org that may be of some help:

There is also this comment in the support forum.

StackOverflow.com contains yet another approach to consider as an alternative.

Maybe you should look at Alter a Views query to use "OR" through the user interface also (it might help to change change your mind about the Views Contextual Filters OR module anyway). Because 3,855 reports installs of that module is not nothing, right?

Drupal 6:

If you're still using D6, then maybe module Views OR is what you are looking for? Excerpt from its project page:

By default, each record in a view must match all filters. Sometimes records need to be included if they match one or more filters in a list of alternatives. Views has the ability to combine filters only with AND. If one filter is false, the combined list will be false. Views Or adds the ability to combine blocks of filters with OR. If one of the filters in the block is true, the combined block will be true.

Note about the "my website is too big" ...

That's perfectly understandable. But that also implies that you should really invest in setting up some kind of testing / staging environment where you have like a mirror of your production environment. So that in THAT environment you can safely experiment / review / finetune what's needed, without impacting your production environment. And after you found the fix in that environment, you should have a process in place to actually MIGRATE it to the production environment ...

A pretty forward (simplistic) approach to this is to transform your existing production site into a multi site setup, whereas you do not change anything to the production site version, but you just add 1 (or more) sites like 'test', 'QA', 'User Acceptance Testing'. These extra sites mostly use the same code base (as production), but with their own copy of the Drupal database. And code changes (or extra modules to be added), first go in site specific subdirs. After they get approved, they are "promoted" to the "all" subdir.

  • Yeah i found "Views Contextual Filters OR" module but that's the problem, my website is too big and currently in production so we don't want to have problems because of bugs or something. BTW thank you
    – xstean
    May 19, 2015 at 16:15
  • Thank you for the accept, a b it late, but still: merci beaucoup! Next question? Dec 7, 2015 at 21:24
  • There is a Drupal 8 version of the views_contextual_filters_or module already.
    – milkovsky
    Feb 11, 2020 at 16:04

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.