Views filter out nodes based on taxonomy field I have multiple node types on my website and a special View listing all the nodes on the site.

I have a taxonomy field which I have applied to some node types but not others. The trouble is any user with editor permissions can add the taxonomy field to any node type which previously did not have it.

My Views needs to list content only of node types which have the taxomony field included. In other words, if a node type does not have field_taxonomy_example included, my View should list NO nodes of that type.

My problem is I can't find a way to dynamically exclude node types - statically setting them is not an option because new types can be added any time.

Please help :-)
I found a programmatic solution after visiting the Views API page.

Using the following code:

function mymodule_views_query_alter(&amp;$view, &amp;$query){
$types = db_select('field_config_instance', 'fci')
        -&gt;fields('fci', array('bundle'))
        -&gt;condition('field_name', 'field_taxonomy_example', 'like')
        -&gt;execute()
        -&gt;fetchCol();

$query-&gt;add_where(0, $query-&gt;fields['node_type']['field'], $types);


}

I was able to insert a dynamic list of node types to test my Views again.

Works like a charm.