How not show in a View certain taxonomy items if there are no associated nodes? I'm using a View to display all the items from a taxonomy term list I've setup. The taxonomy term is used as a field in my nodes. That's all fine.

Now, I created another view called 'all categories' that displays all the taxonomy terms (each term is only displayed once). When a user clicks the term they automatically go to the term page and see the nodes that are using that term.

The problem is that some of the terms haven't yet been used by any nodes so when the user clicks the term name for those it just takes them to a page that says [name] at the top with no other information. I'd rather just hide any categories that have no associated nodes, but I don't know how to do it. I'd also be open to other suggestions for alleviating this issue.

Note: if a term DOES have nodes associated with it and you click the term it takes you to a page with the term as the title and the associated nodes listed below the title.

Here's the settings I have for the 'All categories' view:

Show: Fields
Fields: Taxonomy term: Name (link this field to its taxonomy term page)
Filter Criteria: Taxonomy vocabulary: Machine name (=Category)
Easiest way is to add a relationship in the view to the node type that contains the taxonomy term reference field and make it mandatory. This will force Views to only return the taxonomy terms that are present on a node.


Edit your view
Expand "advanced" (if its not already expanded)
Click "Add" beside Relationships
Click "Taxonomy term: Representative node"
Click "Require this relationship"
Click "Apply"


Note: I used the representative node vs the content with term option for performance reasons, the former only retrieves a single node for each term vs matching every term to every node