I have a proximity search set up using gmap location by postal code. Using Drupal 7/Views 3. The exposed filter allows the user to filter by (taxonomy)type and/or postal code.

This is what I need to Do: Include some content that will not have a postal code in all results. I already set up a view of this content (without postal code) to display as no results behavior. but I would like to include this same content in all searches. How do I do this?

1 Answer 1


If you can not do it with the 'And/Or' option on the filters (accessed by clicking the little arrow next to the filters in the views ui). This is the best option.

Or you could use hook_views_query_alter to add something like "or where postcode = '' ".
I can not really go into detail of adding to the query as I dont know the structure of your query but you can take a look at the database api or search google.

  • I would highly recommend you use the And/Or option if possible. The alternative takes you out of the Views UI, causing confusion later on if you do not realize the hook is there. Trying to get it working in Views UI saves you time now, and a headache in the future. Commented Sep 19, 2014 at 18:32
  • I totally agree, It seems I did not word my answer very well. I have updated it.
    – 2pha
    Commented Sep 19, 2014 at 18:37

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.