I have created a view with three exposed filters. Now I have to hide these Fields dynamically - if field is not present in any of the content types of the nodes in current result, filter based on this field should not be visible. I am using Drupal 7.

1 Answer 1


You have to create a small module or add a function into template.php where you use a one of the hook alter functions. You test your view results for a given set, and if you at that result don't need the filter you unset it. Probably the best hook is: hook_views_pre_render.


Check out the comments on the hook_views_pre_render function to get an idea of how to use it. Hope this gets you on your feet.

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.