Skip to content

Missing Nested taxonomy query support #25

Description

@vinny17690

Hi @jasonbahl,
Just wondering, does this plugin support nested tax queries (added example code below)? I have tried, but couldn't make it work. Looks like taxQuery is limited to only one relation field and one taxArray. Ideally, taxArray should accept the nested taxArray fields right?

Are there any plans to support it, i think it's very crucial to be able to narrow down results to exactly what we want instead of fetching all the data, and process on the frontend.

How do we write below query in WPGraphQL? Any help would be great. Thanks!

'tax_query' => array(
    'relation' => 'AND',
    array(
        'taxonomy' => 'post_tag',
        'terms' => array( 'gum', 'cereal', 'candy' ),
        'field' => 'slug',
        'operator' => 'IN',     
    )
    array(
        'relation' => 'OR',
        array(
            'taxonomy' => 'favorite_turtle',
            'terms' => array( 'Raphael' ),
            'field' => 'name',
            'operator' => 'NOT IN',
        ),
        array(
            'taxonomy' => 'favorite_soda',
            'terms' => array( 'RC' ),
            'field' => 'name',
        ),
    ),
),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions