UPDATE: Shawn's answer is correct but I'd like to mention for anyone else looking to implement it. The arguments must match the contextual filters you've added, in the same order.

Right now I'm embedding views using

print views_embed_view('customview', 'customblock');

in a block. Is there a way that I can still embed a view in a block and pass in a parameter to it. I'd like to create a filter like this

print views_embed_view('customview', 'customblock', 'customcategory');

Is this possible?

1 Answer 1


Yes, your example does exactly what you're wanting. Read the docs on views_embed_view...

"...: Any additional parameters will be passed as arguments."

  • I'm wanting to filter by category and have made category the first contextual filter but when I enter print views_embed_view('customview', 'customblock', 'customcategory'); I get no results. Is there something I'm missing?
    – Amy
    Commented Apr 9, 2015 at 14:50
  • Nevermind turns out I was supposed to use the term id rather than the name.
    – Amy
    Commented Apr 9, 2015 at 15:50

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.