'OR' Queries with EntityFieldQuery February 21, 2012 in Development, Drupal 3 Comments on this post. Joshua Turton An interesting adjunct to this is that the addMetadata() and getMetadata functions allow you to pass data back and forth alongside your query tag. This can be useful if, for example, you are adding a WHERE to your query that isn’t as easy to access as the current NID. Justin Geeslin Thanks for writing what appears to be the only information on how to do this. If I have to extend a class and use a hook alter just to do an OR query, I think I’ll stick with Views. joseph_cheek You don’t really need to create a subclass to do it… this example just made a bunch of stuff (initializing some query defaults, adding the tag, etc.) automatic when instantiating a type of this class. You can, instead, just add the tag and write the hook_form_TAG_alter. I haven’t found a way around using a global variable for any parameters needed by the alter, though. Ideas welcome. for debugging, i add: dpm((string) $query, ‘query before alter’); and dpm((string) $query, ‘query after alter’); to the beginning and end of the hook function and can see what the hook gets and what it does.