Cannot use 'exclude' in contextual filter to exclude results

Created on 17 June 2020, over 4 years ago
Updated 30 July 2024, 5 months ago

I have a view setup to show related content, the related content may reference the current node, or reference the same terms as the current node. To achieve this there are a couple of contextual filters returning the content ID from URL using relationships.

I'm attempting to exclude the current node from the returned list of related content by setting up an additional contextual filter by content ID and ticking exclude. However this seems to exclude all the relevant results.

It seems moving from AND conditional logic to OR makes this rather difficult. Is there any way around this?

🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

🇦🇺Australia aeski

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇩🇪Germany AgathaCrystal Potsdam

    I'm currently experiencing the exact same issue with almost the same setup. For me I load my view in TWIG like so and pass the arguments directly. The node ID be excluded:
    {{ drupal_view('ubersicht_referenzen', 'simular_references', node.id, objectTypes|join(',')) }}

    And in my view it looks like so:

    Each filter is working by itself. They also work together if my content.id isn't excluded, but as soon as i set the filter to exclude, both filters are not working anymore. I'm currently running Drupal 10.2.3 with a PostgreSQL Database.

    It seems this issue is not outdated and still exists.

  • Status changed to Active 5 months ago
Production build 0.71.5 2024