Exclude node referenced from Related Views I have a view which show 4 related nodes based on category. Issue is that there is an entity reference product_group, in the node, and I want to show only those nodes which are not in product_group reference field.

This only involves one content type.
THis things might be solved in many ways, but the 2 solutions which we can use is.


We can add entity reference filter in Filter section of view. Entity Reference Filter is a view of type entity reference, and it should return node id based on arguments, and in our parent view, we can apply condition, that is not one of.
We can add a contextual filter of NID, with option of provide default value >> fixed value, and under more section, we can check exclude checkbox. After that we can use hook_views_pre_view, to set the argument, if it is first contextual filter, then using $arg[0], if it is second contextual filter, then using $arg[1].